socket programming strategy

Jeethu Rao jeethur at sancharnet.in
Sat Jan 18 19:17:28 CET 2003


I've been writing a multi threaded server,
Can't use select, because there'll be a bit number 
crunching to do.

My first stab at it was to use non blocking sockets
And checking for the WSAEWOULDBLOCK in the exception
Generated by the socket module. Obviously, it's Win32
Only and very un portable. So, I started using 
Timothy O'Malley's timeoutsocket module. But, I'm
Not quite satisfied (and dissatisfaction is quite a
Pain in the mind). Today, I hit upon the idea of using
select() calls inside threads, waiting for just one socket.
And I believe select() is a lot more efficient than simple
Busy waiting loops. For Unix, I assume errno.EWOULDBLOCK is
Quite the same as WSAEWOULDBLOCK.

Is this plan workable? Or have I missed something?

Thanks,

Jeethu Rao






More information about the Python-list mailing list