Kacheong Poon wrote:
On 05/ 7/11 12:49 AM, Rao Shoaib wrote:
Yes of course. And Oracle does seem to describe the behavior in both
Java and Solaris documentation.
http://download.oracle.com/javase/1,5.0/docs/api/java/net/SocketOptions.html#SO_LINGER
I'm aware of this legacy java.net.Socket specification. I've
asked the person working on Java networking. The New I/O Java
API's is vague on the exact behavior. Since Java networking is
technically above the socket API, so "theoretically" it can
change the meaning of SO_LINGER option. Hence I specifically
asked about *Solaris* apps using the option directly.
*See Also:*
Solaris: setsockopt(3SOCKET)
The SO_LINGER option controls the action taken when unsent
messages are queued on a socket and a close(2) is performed.
If the socket promises reliable delivery of data and
SO_LINGER is set, the system will block the thread on the
close() attempt until it is able to transmit the data *or
until it decides it is unable to deliver the information (a
timeout period, termed the linger interval, is specified in
the setsockopt() call when SO_LINGER is requested)*. If
SO_LINGER is disabled and a close() is issued, the system
will process the close() in a manner that allows the thread
to continue as quickly as possible.
If you read the above carefully, I don't think it actually
specifies that the underlying connection is reset. It is
vague, hence my question.
It seems clear to me or what is the purpose of timeout ? but anyways
here is what Linux says and the same text appears on IBM's websites as well.
http://www.kernel.org/doc/man-pages/online/pages/man7/socket.7.html
*SO_LINGER*
Sets or gets the *SO_LINGER* option. The argument is a /linger/
structure.
struct linger {
int l_onoff; /* linger active */
int l_linger; /* how many seconds to linger for */
};
When enabled, a close(2)
<http://www.kernel.org/doc/man-pages/online/pages/man2/close.2.html> or shutdown(2)
<http://www.kernel.org/doc/man-pages/online/pages/man2/shutdown.2.html> will not
return until all
queued messages for the socket have been successfully sent or the
*linger timeout has been reached*. Otherwise, the call returns
immediately and the closing is done in the background. When the
socket
is closed as part of exit(2)
<http://www.kernel.org/doc/man-pages/online/pages/man2/exit.2.html>, it always
lingers in the background.
Rao.
_______________________________________________
networking-discuss mailing list
networking-discuss@opensolaris.org