You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@ws.apache.org by Michael Zwettler <mi...@gmx.at> on 2004/10/21 16:55:43 UTC

connection keepalive

Hi!

I'm trying to write a xmlrpc client that keeps a permanent
connection to a server. Therefor i use XmlRpc.setKeepAlive(true).
This works fine (the connection is kept open) if all requests
are done without a delay between them. But if i do:

   execute request #1
   wait 5 seconds
   execute request #2

the client closes the connection before executing the second
request.

Any ideas why the connection is closed?

Michael

Re: connection keepalive

Posted by Jochen Wiedmann <jo...@freenet.de>.
Michael Zwettler wrote:

> Is this http 1.1 compliant? I thought in http 1.1
> the connections are kept open until a "Connection:
> close" header is sent?

I believe, that you are right. I have another question, though: Does the 
XML RPC client actually handle keepalive? IMO this should be handled 
solely by the underlying HTTP protocol handler, either java.net.url, or 
Apache httpclient. If I am wrong: Where does the XML RPC client handle 
keepalive?


Jochen

-- 
http://lilypie.com/baby1/050423/1/5/1/+1

Re: connection keepalive

Posted by Michael Zwettler <mi...@gmx.at>.
Update:

the apache xmlrpc client keeps the connection open
only if the server response contains a

   Connection: Keep-Alive

header. Without this header the client closes the
connection.

Is this http 1.1 compliant? I thought in http 1.1
the connections are kept open until a "Connection:
close" header is sent?

Michael

Re: connection keepalive

Posted by Michael Zwettler <mi...@gmx.at>.
Hello,

i checked the http headers (with tcpdump):

the xmlrpc-client sends a http 1.1 request with

   Connection: keep-alive

in the header. This is useless in http 1.1 because
- permanent connections are the default
- only "Connection: Close" is supported

The server sends the response without a "Connection:" entry
in the (http 1.1) header. This means the client should keep
the connection open.

After a few seconds, the client closes the connection.

Does the client expect a "Connection: keep-alive" from the
server?

Michael


Michael Shillinger wrote:
> Michael,
> 
> Are you sure the client is closing the connection and not the server?
> 
> The server needs to support and allow keep-alive.
> 
> When you setKeepAlive(true) you are simply telling the server that want and can handle a persistent connection.
> 
> The Server will normally respond whether will it allow keep-alive using,
> 
> Connection: Keep-Alive
> -or-
> Connection: close
> 
> see http://www.io.com/~maus/HttpKeepAlive.html for more info.
> 
> 
> Check the header in the response to see how the server is responding.
> 
> The best way to check is to use a sniffer (like Ethereal http://www.ethereal.com/)
> 
> 
> 
> Mike

RE: connection keepalive

Posted by Michael Shillinger <ms...@lucent.com>.
Michael,

Are you sure the client is closing the connection and not the server?

The server needs to support and allow keep-alive.

When you setKeepAlive(true) you are simply telling the server that want and can handle a persistent connection.

The Server will normally respond whether will it allow keep-alive using,

Connection: Keep-Alive
-or-
Connection: close

see http://www.io.com/~maus/HttpKeepAlive.html for more info.


Check the header in the response to see how the server is responding.

The best way to check is to use a sniffer (like Ethereal http://www.ethereal.com/)



Mike





>-----Original Message-----
>From: Michael Zwettler [mailto:michael.zwettler@gmx.at]
>Sent: Thursday, October 21, 2004 10:56 AM
>To: xmlrpc-user@ws.apache.org
>Subject: connection keepalive
>
>
>
>
>Hi!
>
>I'm trying to write a xmlrpc client that keeps a permanent
>connection to a server. Therefor i use XmlRpc.setKeepAlive(true).
>This works fine (the connection is kept open) if all requests
>are done without a delay between them. But if i do:
>
>   execute request #1
>   wait 5 seconds
>   execute request #2
>
>the client closes the connection before executing the second
>request.
>
>Any ideas why the connection is closed?
>
>Michael