Well AFAIK that's the normal behaviour in HTTP 1.0, the client connects, sends an HTTP request, gets a response and the server closes the connection. You need to be using HTTP 1.1 and specify in the HTTP request that the connection should be kept alive I think (using the header Connection: keep-alive).
/Niklas Murat OZDEMiR wrote: > > I've now tested using other simple TCP client utility, and faced that one of > them is closing connection after around 20 seconds but the other is not. The > problem is > when i send a http request, the connection/session is closed as soon as > response is received. > I should find out why. > Any comments? > > ---------- > Murat OZDEMIR > > -----Original Message----- > From: Murat OZDEMiR [mailto:[EMAIL PROTECTED] > Sent: Wednesday, March 28, 2007 10:33 AM > To: '[email protected]' > Subject: RE: SocketConnector Closes Session at 20 sec. > > First is "Apache-Coyote/1.1" which belongs to us and second is > "Apache/1.3.37 (Unix)" which belongs o GSM operator smsc http server. > > ---------- > Murat OZDEMIR > > -----Original Message----- > From: Niklas Therning [mailto:[EMAIL PROTECTED] > Sent: Wednesday, March 28, 2007 10:09 AM > To: [email protected] > Subject: Re: SocketConnector Closes Session at 20 sec. > > What server are you connecting to? Could it be that the server closes idle > connections after 20 seconds of idleness? > > /Niklas > > Murat OZDEMiR wrote: > >> Latest news about " SocketConnector Closes Session at 20 sec." >> >> I have a poller method which is executed at every 20 seconds by a >> timer schedule. So i see that the socket is closed after 20 seconds. >> But i guess that session is closed whenever a http response received from >> > web server. > >> You can find an image attached. A thread named >> "SocketConnectorIoProcessor-0.0" is somehow closed. I don't know why. >> Any comments? >> >> ---------- >> Murat OZDEMIR >> >> -----Original Message----- >> From: Trustin Lee [mailto:[EMAIL PROTECTED] >> Sent: Wednesday, March 28, 2007 5:40 AM >> To: [email protected] >> Subject: Re: SocketConnector Closes Session at 20 sec. >> >> Hi Murat, >> >> On 3/27/07, Murat Ozdemir <[EMAIL PROTECTED]> wrote: >> >> >>> Hi all, >>> SocketConnector closes Session at 20 sec. when idle. But i have set >>> the worker timeout to 100 sec. >>> >>> Despite >>> // worker timeout to 100 second to make the I/O thread quit soon >>> connector.setWorkerTimeout( 100 ); >>> >>> >> I/O processor will never quit if there's any connected session. The >> worker timeout is applied only when there's no connected. Therefore, >> you don't need to adjust this property at all. >> >> >> >>> and >>> // HTTP_CONNECT_TIMEOUT = 10 sec. >>> cfg.setConnectTimeout( >>> SmsCenterConstants.HTTP_CONNECT_TIMEOUT ); >>> >>> >> The connect timeout is applied only for a connection attempt. If the >> session is already connected and created, this property doesn't affect >> the session at all. >> >> I suspect that you set idle time to 20 seconds, or the client is >> configured to close the connection when it's idle for 20 seconds. The >> code will look like this for example: >> >> session.setIdleTime(IdleStatus.BOTH_IDLE, 20); >> >> HTH, >> Trustin >> -- >> what we call human nature is actually human habit >> -- >> http://gleamynode.net/ >> -- >> PGP Key ID: 0x0255ECA6 >> >> > > > > -- Niklas Therning www.spamdrain.net
