C Network programming delves into the low level network layers as you might expect. Therefore understanding network layers and how they are organizaed is quite important.
1. Network Layers
The Open Systems Interconnect(OSI) model was designed to promote interoperability by creating a guideline for network data transmission between network devices.
2. Network Layer – IP
The IP layer routes IP packets through the network from one particluar host to another.
3. Transport Layer – TCP
TCP (Transmission Control Protocol) is a connection-based protocol that provides a reliable flow of data between two computers.
The following protocols use TCP as its transport layer.
- Hypertext Transfer Protocol (HTTP)
- File Transfer Protocol (FTP)
4. Transport Layer – UDP
UDP (User Datagram Protocol) is a protocol that sends independent packets of data, called datagrams, from one computer to another with no guarantees about arrival. UDP is not connection-based like TCP.
The TCP and UDP protocols use ports to map incoming data to a particular process running on a computer. Port numbers range from 0 to 65,535 because ports are represented by 16-bit numbers. The port numbers ranging from 0 – 1023 are restricted; they are reserved for use by well-known services such as HTTP and FTP and other system services.
The following ports are called well-known ports.
- Telnet : 23
- POP3 : 110
- SMTP : 25
- HTTP : 80
- HTTPS: 443
- FTP : 20, 21