Please mail responses and I will post useful replies.
any information that you can provide is appreciated
thanks
Doug Toppin
uunet!melpar!toppin
703-560-5000, x4731
I believe the explanation below fully describes SO_LINGER, but if you have
any further questions, I might be able to answer them.
Eric G. Knox
kn...@aplexus.jhuapl.edu
--- BEGIN INCLUDED DOCUMENT ---
1.7.2 Closing a Connection: SO_LINGER
Specify the SO_LINGER option to determine whether TCP should perform a "grace-
ful" close:
setsockopt (sock, SOL_SOCKET, SO_LINGER, &linger, sizeof (linger));
A graceful close occurs when a connection is shutdown, TCP will try to make
sure that all the unacknowledged data in transmission channel are acknowledged
and the peer is shutdown properly by going through an elaborate set of state
transitions. The variable linger is contains values indicating the amount of
time to SO_LINGER as specified in the data structure linger in the file
vw/h/socket.h. The structure linger contains two parameters: l_onoff and
l_linger. The parameter l_onoff can be set to 1 to turn on the SO_LINGER
option and set to 0 to turn off the SO_LINGER option. The parameter l_linger
determines the amount of time for the shutdown. If the parameter l_onoff is set
to 1 and l_linger is set to 0, the default value of TCP_LINGERTIME (specified
in tcp_timer.h) is used for incoming connections accepted on the socket.
When SO_LINGER is turned on and l_linger is set to 0, TCP simply drops the
connec tion by sending out a RST if a connection is already established. This
frees up the space allocated to the TCP protocol control block and wakes up all
the sleepers on the socket.
Currently, the exact value of l_linger is actually ignored (other than 0) so
that TCP performs the state transitions if l_linger is not 0 but doesn't
explicitly use its value. For the client side socket, the value of l_linger is
not changed if it is set to 0. Issue another setsockopt( ) after the accept( )
call to ensure that the value of l_linger is set to 0 on a newly accepted
socket connection.
--- END INCLUDED DOCUMENT ---