are sockets bloking on WinTN...

Gordon McMillan gmcm at hypernet.com
Mon Jul 30 09:32:04 EDT 2001


[posted and mailed]

"Pete" <pete at ipartners.pl> wrote: 

> According to docs I never should receive (10035, 'The socket operation
> could not complete without blocking') error with blocking sockets. But
> on my NT box this is what I got:

Actually, 10035 means "Resource temporarily unavailable". It's been
translated in socket.py (to the usual but not the only cause).
 
> Traceback (most recent call last):

[snip]

>     hdr = self.__socket.recv( struct.calcsize(FORMAT) )
>   File "<string>", line 1, in recv
> socket.error: (10035, 'The socket operation could not complete without
> blocking')

Could it be that another thread is doing something with this
socket? Are you sure the socket connection logic has completed?
 
> callback is SLOT to QSocketNotifier (for those who know PyQt...)

I don't, but you'll probably need to look at the code that
triggers the callback to find out what's really going on.

[snip]

> 17:     def receive( self ):
> 18:         self.__socket.setblocking( 1 )
> 19:         hdr = self.__socket.recv( struct.calcsize(FORMAT) )

recv (even on a blocking socket) will return whatever is available,
not necessarily what you asked for. You need to loop (or use
socket.makefile - the returned object will do it for you).

- Gordon



More information about the Python-list mailing list