Re: Does close() close a TCP socket?

David Schwartz (davids@webmaster.com)
Mon, 16 Feb 1998 15:34:34 -0500


>This all appears to work correctly except for one small catch. If I
>terminate the server and attempt to restart it immediately the Linux
>kernel refuses to allow the server to bind to the port.

Setting SO_REUSEADDR might help.

>So. Is this the expected behavior from the kernel? Is there a reason
>why the kernel is not terminating the sockets after the server closes
>them and then quits?

Yes, this is expected behavior. The kernel is responsible for ensuring
an orderly close of the sockets, including handshaking with the remote end
and, if necessary, timing out.

DS

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu