s = socket (AF_INET, SOCK_STREAM, 0)
s.bind ((222.222.222.222, 1040))
s.listen (1)
^^^^^^^^^^^^^^^^^^^^^^Program stops here.
read, write, exc = select ([s.fileno()],[],[], timeout)
if s.fileno() in read:
news = s.accept ()
s.close()
Note: this is quick hack, use with care :-)
This is similar to what I am using right now, The problem is the program stops
at listening until having a connection. Rest of the program will not be
executed until a connection comes in. So I can either doing idle detection
with some timer which sends out signal or having connection before forking
a child and passing the socket object to the new program that child executes.
Whoops ! That sounds very dodgy. What OS are you using - "normal"
Unix uses listen to register a socket for listening, ie. the call
should return "immediately", not hang. I've check SGI, AIX, Linux,
they are all the same, (even Tandem's Guardian OS), and Stevens' Net
Prog. book (excellent by the way). The small amount of python I've
done using sockets worked okay, so I wouldn't have thought it was
python. Have you tried do a similar thing using C ?
Sorry I can't help further :-(
Adrian
-- ------------------------------------------------------------------------- = Adrian Phillips at | BUT any thoughts in this are purely = = The Norwegian Meteorological | my own and have nothing to do with = = Institute | this establishment, thankfully. = = Net: adrian.phillips@dnmi.no | Phone: 47 22 96 32 09 Fax: 47 22 96 30 50