In order to facilitate the debugging of networking code I have used my library, <a href=http://pcs.sf.net>Packet Construction Set aka PCS</a> to write a program I call the <a href=http://pktdbg.sf.net>Packet Debugger (pdb)</a>. All of this is written in Python and available under a BSD license. The blurb from the pdb web page gives you the best idea of what I’m doing:
“The Packet Debugger (pdb) is a program which allows people to work with packet streams as if they were working with a source code debugger. Users can list, inspect, modify, and retransmit any packet from captured files as well as work with live packet capture.” – pdb web page
There is a twelve page manual on the web page that describes how to use the debugger as well.