On Nov 17, 11:32 pm, 7stud <[EMAIL PROTECTED]> wrote: > According to "Python in a Nutshell(2nd)", p. 523: > > connect: s.connect((host, port)) > ... > Blocks until the server accepts or rejects the connection attempt. > > However, my client program ends immediately after the call to > connect()--even though my server program does not call accept(): > > #server---------------- > import socket > > s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) > port = 3200 > s.bind( ('', port) ) > s.listen(5) > > import time > time.sleep(20) > > #client---------------- > import socket > > s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) > host = 'localhost' > port = 3200 > > s.connect( (host, port) ) > print 'done' > > If I start my server program and then start my client program, the > client ends immediately and displays: done. I expected the client > program to block indefinitely.
a better question is why you are not using higher level libraries, such as twisted -- http://mail.python.org/mailman/listinfo/python-list