This Indian guy has a nice article about writing a simple packet sniffer using C and libpcap. Learning to write a packet sniffer may be your first step in order to write more advanced network security tools, such as IDS's, Network Protocol Analyzers, Firewalls, etc.
Amit Saha's Packet Sniffer
P.S. Geocities is dead and so is the above link :(
Tags: Programming, Networking, Security, Gr33n Data