help using sockets, and OOP?

Andy Gross andy at
Mon Dec 6 18:45:16 CET 2004

On Dec 6, 2004, at 12:04 PM, Dfenestr8 wrote:

> Ok, so are there other types of sockets that aren't "blocking" ?

Yes, sockets can be either blocking or non-blocking.  An I/O operation 
on a 'blocking' socket will not return until the operation is complete. 
  If you try to read more bytes than are currently available, the call 
will block, possibly forever.  Operations on non-blocking sockets 
return "immediately", but are not guaranteed to have completed.  For 
example, a write() of 1024 bytes may only succeed in writing 10 bytes.  
It's up to your application to keep track of this state.  Google around 
for socket programming tutorials for complete information.

WRT Python, you'll quickly find that asynchronous programming becomes 
tedious without a framework.  As JP suggested, check out  Twisted does a good job of abstracting 
away a lot of the low-level details and allows you to focus on 
implementing the functionality of your program.

Good luck,


More information about the Python-list mailing list