For basic networking, libpcap
is one of the more accessible protocols to get at the guts of the packets going by without too much of an overarching system. Unfortunately, the documentation varies in quality and in my experience is often lacking in terms of examples at the higher end. The goal of this tutorial is to both gather the existing tutorials that are out on the web (in one form or another) along with providing ample sets of example code and discussions on using libpcap.
With that being said, you should also ask yourself what your end goal is with writing software? Would a raw socket suffice? Do you need a bit more robust learning curve albeit with a relatively more stable system? You might want to also check out the following options for developing network software:
- Network simulators
- Mixed network simulator / emulators
- Wireless drivers
- Software routers
In the interim before I have a chance to type up more details, you are welcome to download via the main NetScale
webpage the source code for RIPPS
(busy, lots of interlinked parts) and ScaleBox
(much cleaner implementation). The most notable file for each is the Adapter.cc and Adapter_PCap.cc files that cover startup / interactions with libpcap.
- ns3 aka nsnam - While it is in alpha form as of this writing, ns3 should have much better emulation capabilities than ns2.