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

Giovanni Tumiati giovanni at poseidon.home.net
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
  try:
  #...waiting for connection
  (client, address)=sa.accept()
except sa.timeout: <--------------there is no such exception for a socket!
 #...waiting for connection timeout
 continue
except:
 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!
pete




More information about the Python-list mailing list