- The Fundamental Network Packet
- Dissecting the Various Packets
- How the IP Protocols Fit Together
- Snooping the Network with Tcpdump
- Writing a Custom Network Snooper
- Summary: Choosing the Best Packets for Sending Messages
Summary: Choosing the Best Packets for Sending Messages
You can use tcpdump and the snooper to print the different kinds of packets that your computer sends and receives. These packets, in the case of IP, may be raw IP packets, error messenger ICMP packets, UDP datagrams, or TCP stream messages. Each packet type fills a specific role while leaving plenty of room for expansion.
Each packet has its own header. ICMP, UDP, and TCP attach their headers to the IP header. The total dedicated to these headers ranges in size from 20 bytes to 120 bytes. The balance between the headers and the real data affects the network throughput.
TCP has the least throughput because of the header-to-data ratio. Because it provides the most reliable communication between two computers, it is the most-used protocol on the Internet. TCP offers streaming interface that allows you to use the higher library I/O functions, such as fprintf() and fgets().
You can use UDP to send single messages to different hosts without reconnecting. It virtualizes the network using ports, making it seem that your connection has exclusive access to the network. UDP provides good throughput but unreliable transmission.
The most commonly used protocol is TCP, because of its reliability. UDP follows distantly behind it. The network today has stepped away from trying to use the very-low-level packets and interfaces and toward sending messages. The performance is not as important as the reliability, but users continue to notice the performance issue.