A protocol is set of rules that determine how communication between two parties is achieved.
Both machines and people use protocols to communicate.
Physical layer protocols for human communication include:
- One person’s vocal cords produces sound waves, which generate vibrations in the ear drum of another person.
- One person writes on paper while another person reads the writing from the paper.
- One person uses his hands to make set shapes and movement patterns, while another person views the sign language with his eyes.
Language layer protocols include: English, French, Spanish ...
Multiple protocols are often used together in layers. In the example of human communication, we use both a physical layer and a language layer together.
Protocols may be replaced as long as the new protocol fills the same role. For example, I use English to speak with my friends, but other people may prefer to use Spanish or some other language. The physical layer may be the same, but different functionally equivalent languages may be used.
Common networking protocols include:
| Layer | Protocol |
|---|---|
| Physical | CAT 5/6 cables, fiber optics, Wireless 802.11 |
| Data Link | Ethernet |
| Routing | IP |
| Transport / Session | TCP, UDP |
| Application | HTTP, SMTP, FTP, ... |
Depicted above are protocols commonly used with TCP/IP. We may substitute TCP for UDP or use different application layer protocols.
We will not concern ourselves at all with the physical or data link layers, which are implemented with hardware components. Our primary concern for this class is at the application layer. So we are concerned with application layer protocols and the hand-off mechanism to and from TCP/IP, which is the socket.
TCP/IP is not one protocol, but a suite of small, specialized protocols called sub-protocols.
The IP header contains information necessary for routers to transfer data between subnets.
So far, this has been a review of Networking 1 materiel. Now we turn our attention to the basic concepts of writing network applications. The TCP/IP protocol suite is implemented in the computer’s operating system. Ports and sockets are both abstract resources (not hardware) provided by the operating system to facilitate passing data between the operating system and application programs.
Note
Once we understand how to work with ports and sockets, we will turn our attention to application layer protocols and rely on other software to even handle the socket level communication.
Summary:
The TCP protocol picks up and deposits the data at a port, which is a numbered, buffered storage container provided by the operating system as the hand-off point between TCP and the application program.
The TCP Headers hold the port numbers used by the source and destination applications.
A port can be viewed as a rendezvous point between TCP and the application. However, the port is a part of the operating system and the application program can not directly access the port. This is where the socket comes into play.
This is similar to how the Postal Service uses mailboxes as rendezvous points.
Mailboxes are a rendezvous point between the postal carrier and the customer.
As an analogy, think of TCP/IP as the Postal Service. They pick up and leave mail in your mailbox, which is similar to a port. People who live in rural areas are always looking for friends, who might be traveling past the mailboxes, to shuttle their mail. A friend who carries a letter to your mailbox and delivers any mail waiting in your mailbox to you, is performing the same service that a socket does in relation to the application program and the port.
Summary: