Sockets question

Pekka Pessi Pekka.Pessi at iki.fi
Thu Aug 9 09:37:19 EDT 2001


In message <mailman.997349655.23903.python-list at python.org> "frank booth" <killingjoke at mail.com> writes:
>I'm sending something through a TCP socket, then closing it, then my
>python script exits.

>For some reason, from time to time (and not on all machines) the remote
>end doesn't always get the data.

>I thought close() is supposed to terminate the connection gracefully so
>it should be OK, but its not.

>Maybe when the script exits the connection dies at once? 

	Are you using MSWindows? When using MSWindows, the close() to
	socket object actually makes a winsock shutdown(2) call.  The
	socket is destroyed (by calling winsock close()) when the
	application exits.  Most MS TCP implementations simply destroy
	the TCP PCB and discard the buffered unsent data when the socket
	is destroyed.  SO_LINGER, as mentioned by another poster, may
	help.

							Pekka



More information about the Python-list mailing list