closing a socket

Erno Kuusela erno at iki.fi
Fri Jul 21 21:46:59 EDT 2000


if you want to be able to bind to the same port immediately
afterward, you can disable the so-called TIME_WAIT state
by setting the socket option SO_REUSEADDR. (you can
do this with the setsockopt method of socket objects.)

it's not on by default because doing so leads to
(small) risk of data corruption with TCP.

for in-depth explanation of the whole thing, see <URL:http://
www-db.stanford.edu/~cho/programming/unix-socket-faq-4.html#ss4.5>
and <URL:http://www-db.stanford.edu/~cho/programming/
unix-socket-faq-2.html#time_wait>.

  -- erno



More information about the Python-list mailing list