Я всегда думал, что если на сокете в неблокирующемся режиме (O_NONBLOCK) поставить SO_LINGER, то close() будет возвращаться немедленно, а linger time будет определять, сколько времени соединение будет болтаться в полузакрытом состоянии
(
Read more... )
Comments 4
Reply
SO_LINGER controls the action taken when unsent messages are queued on
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 process
on the close(2) 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 seconds in the setsockopt() system
call when SO_LINGER is requested). If SO_LINGER is disabled and a
close(2) is issued, the system will process the close in a manner that
allows the process to continue as quickly as possible.
Так что похоже, во FreeBSD то же самое, и вообще это POSIX.
С помощью SO_LINGER от TIME_WAIT не отделаться.
http://www.developerweb.net/forum/archive/index.php/t-2982.html
Reply
Reply
Reply
Leave a comment