By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,442 Members | 1,332 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,442 IT Pros & Developers. It's quick & easy.

Active time for HTTP connection

P: n/a
Hi,

I am trying to use Ajax to connect with an HTTP server and do some
interactions. The first HTTP request will be longer than others due to
the 3-way hand shake. So I'd like to reuse that TCP channel to avoid
connect again. I wonder the active time for javascript to keep that
HTTP connection alive, so that I could make use of that time to
optimize each connection. Thanks in advance.
Nov 16 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
campos wrote:
I am trying to use Ajax to connect with an HTTP server and do some
interactions. The first HTTP request will be longer than others due to
the 3-way hand shake.
(You are referring to
<news:mc******************@newssvr25.news.prodigy. net>; please continue the
thread next time.)

You got it all wrong. It is not the TCP handshake to establish the
connection that *can* make the first transmission slower.
So I'd like to reuse that TCP channel to avoid connect again.
"TCP channel"? Are you sure you know what you are doing?
I wonder the active time for javascript to keep that
HTTP connection alive,
There is none as "javascript" does not do that; the HTTP client does, caused
by an implementation of the IXMLHTTPRequest interface that is only used
*through* an ECMAScript implementation (such as JavaScript or JScript), if that.
so that I could make use of that time to optimize each connection.
Thanks in advance.
Persistent HTTP connections are maintained server-side. There has to be an
HTTP/1.1-capable server that needs to support that. And if the server
supports it, the next message has to be sent before the server-defined wait
time runs out.

http://httpd.apache.org/docs/1.3/keepalive.html
http://tools.ietf.org/html/rfc2068#section-8.1
PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Nov 16 '07 #2

P: n/a
VK
On Nov 16, 4:23 am, campos <huwen...@gmail.comwrote:
Hi,

I am trying to use Ajax to connect with an HTTP server and do some
interactions. The first HTTP request will be longer than others due to
the 3-way hand shake. So I'd like to reuse that TCP channel to avoid
connect again. I wonder the active time for javascript to keep that
HTTP connection alive, so that I could make use of that time to
optimize each connection.
As it was pointed out, JavaScript doesn't handle HTTP transmissions,
it is a system-level feature.

For IE / Windows with default registry settings, on Keep-Alive the TCP/
IP socked gets freed after 60sec (1 min) of inactivity. For an
intranet solution you may set bigger KeepAliveTimeout for all involved
machines in HKEY_CURRENT_USER\Software\Microsoft\Windows\Curre ntVersion
\InternetSettings

For the Internet one of workarounds would be to make a "slow page"
over script, so dripping the response by small chunks every say 5sec
until the data is ready - then flush the rest of the page. Can be very
irritating though for end-users.
Nov 17 '07 #3

P: n/a
VK
On Nov 17, 3:39 pm, VK <schools_r...@yahoo.comwrote:
For IE / Windows with default registry settings, on Keep-Alive the TCP/
IP socked gets freed after 60sec (1 min) of inactivity. For an
intranet solution you may set bigger KeepAliveTimeout for all involved
machines in HKEY_CURRENT_USER\Software\Microsoft\Windows\Curre ntVersion
\InternetSettings
I have found this KB article that covers the matter more fully:

http://support.microsoft.com/kb/813827
Nov 17 '07 #4

P: n/a
On Nov 16, 11:37 pm, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
campos wrote:
I am trying to use Ajax to connect with an HTTP server and do some
interactions. The first HTTP request will be longer than others due to
the 3-way hand shake.

(You are referring to
<news:mc******************@newssvr25.news.prodigy. net>;please continue the
thread next time.)

You got it all wrong. It is not the TCP handshake to establish the
connection that *can* make the first transmission slower.
Well, then what makes the first transmission longer? I'm thinking that
it takes another RTT to establish the connection for the first HTTP
request. In my situation, RTT is about 170ms, which is negligible.
>
So I'd like to reuse that TCP channel to avoid connect again.

"TCP channel"? Are you sure you know what you are doing?
I wonder the active time for javascript to keep that
HTTP connection alive,

There is none as "javascript" does not do that; the HTTP client does, caused
by an implementation of the IXMLHTTPRequest interface that is only used
*through* an ECMAScript implementation (such as JavaScript or JScript), if that.
so that I could make use of that time to optimize each connection.
Thanks in advance.

Persistent HTTP connections are maintained server-side. There has to be an
HTTP/1.1-capable server that needs to support that. And if the server
supports it, the next message has to be sent before the server-defined wait
time runs out.

http://httpd.apache.org/docs/1.3/kee...68#section-8.1

PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Nov 18 '07 #5

P: n/a
campos wrote:
On Nov 16, 11:37 pm, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
>campos wrote:
>>I am trying to use Ajax to connect with an HTTP server and do some
interactions. The first HTTP request will be longer than others due to
the 3-way hand shake.
(You are referring to
<news:mc******************@newssvr25.news.prodigy .net>;please continue the
thread next time.)

You got it all wrong. It is not the TCP handshake to establish the
connection that *can* make the first transmission slower.

Well, then what makes the first transmission longer? I'm thinking that
it takes another RTT to establish the connection for the first HTTP
request. In my situation, RTT is about 170ms, which is negligible.
The bandwidth allocated for you by statistical multiplexing is shaped
according to your previous network usage. If, and only if, that feature is
implemented along your network path, the first connection is significantly
slower because you have not used that path as much before. That has nothing
to do with the time the TCP handshake takes to establish one connection.

Please trim your quotes:
http://www.jibbering.com/faq/faq_notes/clj_posts.html
PointedEars
--
"Use any version of Microsoft Frontpage to create your site. (This won't
prevent people from viewing your source, but no one will want to steal it.)"
-- from <http://www.vortex-webdesign.com/help/hidesource.htm>
Nov 18 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.