Newbie question: SOLVED (how to keep a socket listening), but still some questions

pwilkins pwilkins at noaddress.org
Fri Jun 24 22:12:29 EDT 2005


On Fri, 24 Jun 2005 21:42:48 -0400, Jp Calderone wrote:


> shutdown actually tears down the TCP connection; close releases the file
> descriptor.
> 
> If there is only one file descriptor referring to the TCP connection,
> these are more or less the same.  If there is more than one file
> descriptor, though, the difference should be apparent.
> 
> Jp


Yes I think you are right. I checked with the "Socket Programming HOWTO"
by Gordon McMillan @ http://www.python.org/doc/howto.

Here's a quote:
"Strictly speaking, you're supposed to use shutdown on a socket before you
close it. The shutdown is an advisory to the socket at the other end.
Depending on the argument you pass it, it can mean "I'm not going to send
anymore, but I'll still listen", or "I'm not listening, good riddance!".
Most socket libraries, however, are so used to programmers neglecting to
use this piece of etiquette that normally a close is the same as
shutdown(); close(). So in most situations, an explicit shutdown is not
needed."

However my first understanding from the python docs is quite different..
it was that like a unix pipe, a socket could be made to communicate in one
direction only. Like a RD-only pipe a socket could be made RD-only and
another socket WR-only...perhaps like ftp keeps the control channel open
but transmits over a read only socket???






More information about the Python-list mailing list