OO design and multiple local sockets

Andrew McGregor andrew at indranet.co.nz
Thu Jan 30 13:36:12 CET 2003


I've got an awful case of writer's block on this one :-(

Problem:  I'm writing an app (an implementation of HIP, see 
www.hip4inter.net) that uses raw sockets in a big way.  It needs to bind 
local sockets to each IP address on the system so it can transmit packets 
with each source address.  It also needs to know which address packets were 
received on, and from where.  So far, so good.  It's threaded (pretty much 
necessarily).  There are two pools of sockets for two different protocols 
that have to interact.

Just the code for the protocol transforms and state machines is about 7k 
lines, including tests, and works, but with only a single unbound local 
socket, so some features I can't do yet.

What I can't figure out is what a clean OO design for the socket handling 
looks like, managing the various queues and worker threads without getting 
really hairy.  Can anyone help?

Andrew
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20030131/a990cbd8/attachment.sig>


More information about the Python-list mailing list