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

Giovanni Tumiati giovanni at
Sat Jun 25 03:08:51 CEST 2005

To all those that replied - thank you.
I solved the problem I posted earlier.
I'm embarrassed to admit that it was caused by the following:
while 1:  ## wait for a connection
  #...waiting for connection
  (client, address)=sa.accept()
except sa.timeout: <--------------there is no such exception for a socket!
 #...waiting for connection timeout
 continue  ## for now ignore this!

There is no "timeout exception" on a socket so the exception was failing.
I don't remember where I read about it, but now I cannot find such an
exception...I guess I dreamt it up :-)

However some of my questions still remain from earlier post:
(1) What is the difference between / how should they be used?
 - setdefaulttimeout(timeout)
 - settimeout(value)

(2)Does one have to do a socket.shutdown() before one does a socket.close??

Again thanks!

More information about the Python-list mailing list