Clean Exit from Socket/Program

Larry ld at nospam.com
Tue Jul 9 16:11:57 EDT 2002


"Bryan Olson" <fakeaddress at nowhere.org> wrote in message
> To terminate socket transmission cleanly, each side should do
> sock.shutdown(1) which terminates sending, and then read until the
> termination of the other's transmission, which you can detect by a
> recv() that successfully returns zero bytes.  Then you can close() or
> destroy the socket.  Contrary to popular belief, doing a shutdown(0) (of
> the receive side) before a close() is unimportant.

The problem here is that I cannot communicate with the other socket.  In
other words, when I connect, data starts to flow.  And data never stops
until the other side sees that I am not there anymore.

So, what I need to do, is somehow signal the server socket and make him
think I am not there, while still being able to process whatever is still in
my buffers so I don't lose it.  Then I could shut down.

Larry





More information about the Python-list mailing list