Discussion:
socket TIME_WAIT state
Ching, Vivian M, ALABS
2005-02-24 11:53:39 UTC
Permalink
If I am using SOAPHTTPConnection to send and receive soap
messages. My question is: when are the socket connections
released? Do I have to do anything explicitly to close it?
Server ends says the socket is going into TIME_WAIT state (sometimes?).
Will this happen if client timesout before response is received?
I am on jdk1.3. Thanks for any help!


Envelope env = null;
Message msg = new Message();
SOAPHTTPConnection st = new SOAPHTTPConnection();
msg.setSOAPTransport(st);
st.setTimeout(2000);

try {
msg.send(new URL(sURL), soapAction, requestEnvelope);
env = msg.receiveEnvelope();
}


Vivian Ching
AT&T
MT A2-2E04
200 S Laurel Avenue
Middletown, NJ 07748
732.420.2452
Achim Grolms
2005-02-24 14:31:12 UTC
Permalink
Post by Ching, Vivian M, ALABS
If I am using SOAPHTTPConnection to send and receive soap
messages. My question is: when are the socket connections
released?
Have a look to src/org/apache/soap/util/net/HTTPUtils.java :

at the end of post( ... )

You will find that the socket is closed at the and of every call
of post(...):

/* All done here! */
bOutStream.close();
outStream.close();
bInStream.close();
inStream.close();
-> s.close();
return response;


HTH, Achim
Scott Nichol
2005-03-01 16:21:33 UTC
Permalink
Stevens' "TCP/IP Illustrated, Volume 1" has the TCP state transition diagram. It is p. 241 in my edition. For a SOAP client, the app leaves the ESTABLISHED state by requesting a close(), which causes TCP/IP to send a FIN to the server. There are a couple of ways TCP/IP can then move to the TIME_WAIT state, but it will always pass through that state. It will stay in that state for 2 * MSL. MSL is specified in RFC 793 as 2 minutes, but as Stevens notes, some implementations use a different value.

Scott Nichol

Do not send e-mail directly to this e-mail address,
because it is filtered to accept only mail from
specific mail lists.
----- Original Message -----
From: "Ching, Vivian M, ALABS" <***@att.com>
To: <soap-***@ws.apache.org>
Sent: Thursday, February 24, 2005 6:53 AM
Subject: socket TIME_WAIT state


If I am using SOAPHTTPConnection to send and receive soap
messages. My question is: when are the socket connections
released? Do I have to do anything explicitly to close it?
Server ends says the socket is going into TIME_WAIT state (sometimes?).
Will this happen if client timesout before response is received?
I am on jdk1.3. Thanks for any help!


Envelope env = null;
Message msg = new Message();
SOAPHTTPConnection st = new SOAPHTTPConnection();
msg.setSOAPTransport(st);
st.setTimeout(2000);

try {
msg.send(new URL(sURL), soapAction, requestEnvelope);
env = msg.receiveEnvelope();
}


Vivian Ching
AT&T
MT A2-2E04
200 S Laurel Avenue
Middletown, NJ 07748
732.420.2452

Loading...