DEV Community

loading...
Cover image for TCP/IP (Transmission Control Protocol/Internet Protocol)

TCP/IP (Transmission Control Protocol/Internet Protocol)

Mahmoud EL-karuony
Full Stack Web Developer
Originally published at mr-webdev.blogspot.com ・4 min read

What is TCP/IP?

TCP/IP is a suite of communication protocols that are used to connect devices and transfer data over the Internet.

TCP/IP can also be used as a communications protocol in a private computer network (an intranet or extra net).

TCP/IP uses:

TCP:

  • Defines how applications create communication channels.
  • Manages when a message is broken down to be transmitted.

IP addresses:

  • An IP address identifies the location of a computer on a network.
  • Defines how to address and route packets for delivery.

Ports:

  • A port is a location on the recipient computer, where data is received.
  • While an IP address tells you where to find a particular computer,
  • It doesn't tell you specifically where on that computer a particular connection should be made—that's what port numbers are for.

Some port numbers you should know:

  • Port 80: The port number most commonly used for HTTP requests.
  • For example, when a client makes a request to a web server, this request is usually sent through port 80.

  • Port 5432: The port number used by most database systems; default port for PostgreSQL.

There are a number of other common ports you might want to get familiar with:

Port Number & Usage:

20: File Transfer Protocol (FTP) Data Transfer.

21: File Transfer Protocol (FTP) Command Control.

22: Secure Shell (SSH).

23: Telnet - Remote login service, unencrypted text messages.

25: Simple Mail Transfer Protocol (SMTP) Email Routing.

53: Domain Name System (DNS) service.

80: Hypertext Transfer Protocol (HTTP) used in World Wide Web.

110: Post Office Protocol (POP3) used by e-mail clients to retrieve e-mail from a server.

119: Network News Transfer Protocol (NNTP).

123: Network Time Protocol (NTP).

143: Internet Message Access Protocol (IMAP) Management of Digital Mail.

161: Simple Network Management Protocol (SNMP).

194: Internet Relay Chat (IRC).

443: HTTP Secure (HTTPS) HTTP over TLS/SSL.

Common TCP/IP protocols include the following:

  • HTTP (Hypertext Transfer Protocol), which handles the communication between a web server and a web browser;

  • HTTPS (HTTP Secure), which handles secure communication between a web server and a web browser;

  • FTP (File Transfer Protocol), which handles the transmission of files between computers.

How does TCP/IP work?

TCP/IP uses the client-server model of communication in which a user or machine (a client) is provided a service, like sending a webpage, by another computer (a server) in the network.

Collectively, the TCP/IP suite of protocols is classified as stateless, which means each client request is considered new because it is unrelated to previous requests.

Being stateless frees up network paths so they can be used continuously.

The transport layer itself, however, is stateful.

It transmits a single message, and its connection remains in place until all the packets in a message have been received and reassembled at the destination.

The TCP/IP model differs slightly from the seven-layer.

Open Systems Interconnection (OSI) networking model designed after it.

The OSI reference model defines how applications can communicate over a network.

TCP/IP functionality is divided into five layers, each of which includes specific protocols:

1- The application layer provides applications with standardized data exchange.

Its protocols include HTTP, FTP, Post Office Protocol 3 (POP3),

Simple Mail Transfer Protocol (SMTP) and Simple Network Management Protocol (SNMP).

At the application layer, the payload is the actual application data.

2- The transport layer is responsible for maintaining end-to-end communications across the network.

TCP handles communications between hosts and provides flow control, multiplexing, and reliability.

The transport protocols include TCP and User Data-gram Protocol (UDP), which is sometimes used instead of TCP for special purposes.

3- The network layer, also called the internet layer, deals with packets and connects independent networks to transport the packets across network boundaries.

The network layer protocols are IP and Internet Control Message Protocol (ICMP), which is used for error reporting.

4- The data link layer, or layer 2, is the second layer of the seven-layer OSI model of computer networking.

This layer is the protocol layer that transfers data between nodes on a network segment across the physical layer.

The data link layer provides the functional and procedural means to transfer data between network entities and may also provide the means to detect and possibly correct errors that can occur in the physical layer.

5- The physical layer, also known as the network interface layer or data link layer, consists of protocols that operate only on a link -- the network component that interconnects nodes or hosts in the network.

The protocols in this lowest layer include Ethernet for local area networks (LAN's) and Address Resolution Protocol (ARP).

Why is TCP/IP important?

TCP/IP is non proprietary and, as a result, is not controlled by any single company.

Therefore, the IP suite can be modified easily.

It is compatible with all operating systems (OSes), so it can communicate with any other system.

The IP suite is also compatible with all types of computer hardware and networks.

TCP/IP is highly scalable and, as a routable protocol, can determine the most efficient path through the network.

It is widely used in current internet architecture.

Uses of TCP/IP:

TCP/IP can be used to provide remote login over the network, for interactive file transfer, to deliver email, to deliver web pages over the network, and to remotely access a server host's file system.

Most broadly, it is used to represent how information changes form as it travels over a network, from the concrete physical layer to the abstract application layer.

It details the basic protocols, or methods of communication, at each layer as information passes through.

Advantages and Disadvantages of TCP/IP:

The advantages of using the TCP/IP model include the following:

  • Helps establish a connection between different types of computers.

  • Works independently of the OS.

  • Supports many routing protocols.

  • Uses client-server architecture that is highly scalable.

  • Can be operated independently.

  • Supports several routing protocols, and
    is lightweight and doesn't place unnecessary strain on a network or computer.

The disadvantages of TCP/IP include the following:

  • Complicated to set up and manage.

  • The transport layer doesn't guarantee the delivery of packets.
    Isn't easy to replace protocols in TCP/IP.

  • Doesn't clearly separate the concepts of services, interfaces, and protocols, so it isn't suitable for describing new technologies in new networks, and
    is especially vulnerable to an SYN (synchronization) attack, which is a type of denial-of-service (DoS) attack in which a bad actor uses TCP/IP.

Discussion (0)