client derived from async_chat

Patrick Useldinger pu
Sun Aug 17 18:20:18 EDT 2003


Erik Max Francis wrote:

> I tried to run your sample but you didn't include enough material for me
> to run it as a standalone application.  When I tried to stub out the
> additional material you didn't include, I got connection refused errors,
> presumably because the server wasn't running at the point your clients
> tried to connect.

Look at the following code:

sock=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
#sock.setblocking(0)
print 'connect rc=',sock.connect_ex((EBHost,EBPort))
try:
     sock.send(message+BLOCKEND)
     response=sock.recv(BUFFSIZE)
finally:
     sock.close()

If I run it without the 'sock.setblocking(0)', it works fine. If 
uncomment that line, I receive the following error:

   File "I:\My Programs\sas\sasLA0.py", line 18, in ?
     response=sock.recv(BUFFSIZE)
socket.error: (10035, 'The socket operation could not complete without 
blocking')

This is exactly what seems to happen with the async_chat class, as in 
dispatcher.create_socket the same setblocking(0) is done.

If you just could shed some light on what this error means, I haven't 
found any explanation up to now.

Thanks.

-- 
Real e-mail address is 'cHVAdm8ubHU=\n'.decode('base64')
Visit my Homepage at http://www.homepages.lu/pu/





More information about the Python-list mailing list