What is TCP and OSI Model? Difference between TCP and UDP?

  TCP and OSI Model

Open System Interconnection (OSI) is a seven-layer model developed by International Standard Organization (ISO) for computer network communication in 1980s. The data moves down each layer added an additional information in form of header and transmitted to the network. At the receiver end, data is again defragmented to receive the original sent data. In OSI model, first the model is defined then protocols are developed to fit into the model.

Transmission Control Protocol / Internet Protocol (TCP/IP) is a four-layer model work similar to OSI model developed by Advanced Research Protocol Agency Network (ARPANET). It is standard protocols that provides the connection between the host network. In TCP model, first the protocols are set and then the model is fit into it.

The figure 1 shows the layers of TCP and OSI models below.



Figure 1 Shows the layers of OSI Model and TCP/IP Model.

In OSI Model, function of each layer is different. They are explained as below:

1.    Application Layer: It is the Top Layer of the OSI model in which manipulation of data directly from the user is done. It consists of various protocols such as HTTP, FTP, SMTP, TELNET and DNS. This layer directly interacts with the user. There are various services provided by this layer such as E-mail services, file transfer, directory services etc.

2.    Presentation Layer: This layer takes care of syntax and semantics of the information exchanged between the two host computers. The primary function is to provide translation, encryption and compression of information to the session layer.

3.    Session Layer: This layer allows different machines to establish session between them. It provides the well-established connection and synchronization between the communicating system. The main function of this layer is to provide dialog control, token management and synchronization.

4.    Transport layer: This layer accepts the data from the above layer and split it into more fragment for further transmission. It provides the error free transmission. The primary function of transport layer is segmentation and reassembling, connection control, error and flow control.

5.    Network Layer: This layer takes care of source and destination address of the subnet. It translates the logical address to physical address and control the router and gateway operation for successfully transmission of data.

6.    Data Link Layer: It provide the node-to-node transmission of frames. Its main function is framing, physical addressing, flow control, error control and access control.

7.    Physical Layer: This layer responsible of sending bits from one computer to another. Its mains function is to representation of bits, interface and synchronization with the transmission and receiving devices.

In TCP/IP model, four layers are used to perform all the functions of the OSI model in a more efficient manner. We can summarize the difference between TCP/IP and OSI model in tabular form below:

S. No.

OSI Model

TCP/IP Model

1

It has 7 layers

It has 4 layers.

2

It uses network layer to define routing protocols and standard.

Internet Layer does all the functions.

3

In OSI model, transport layer is only connection-oriented

In TCP Model, transport layer is both connection-oriented and connection less

4

In OSI model, the data link layer and physical layer are separate layer.

In TCP model, physical and data link are combined in network layer.

5

In OSI model, transport layer gives the guarantees of the delivery of packets.

In TCP model, transport layer does not give any guarantee of delivery of packets.

6

Session and presentation layers are part of OSI Model.

There is no session and presentation layer.

7

In OSI model, protocols are hidden and are easily replaced with the technology.

In TCP model, protocols are not easy to replaced.

8

There is clear definition of services, interfaces, and protocols.

There is no clear definition of services, interfaces, and protocols.

9

It is protocol independent.

It is protocol dependent.

 

The advantages of using OSI are as follows:

1.    It reduces complexity and define standardized interfaces.

2.    Protocols can be replaced by new protocols when the technology changes.

3.    It offers flexibility to adapt various protocols.

4.    It is a standard model in computer networking.

The disadvantages of OSI model are as follows:

1.    It does not define any specific protocol, so we have to use reference model. Fitting of protocols is itself a challenging task.

2.    OSI layers can’t work in parallel as each layer have to wait for the data from the previous layer.

 

The advantages of using TCP/IP model are as follows:

1.    It has complexed structure and interfaces.

2.    It supports multiple routing protocols.

3.    It can be operated independently.

4.    It is highly scalable client-server architecture.


The disadvantages of TCP/IP model are as follows:

1.    There is no clear separation between services, interface, and protocols.

2.    Overhead of TCP/IP is higher than OSI model.

3.    It is difficult to setup and manage.

Difference between TCP and UDP?

Transmission control protocol and User Datagram Protocol are a transport layer protocol used to provide the transmission of data. But there is a large difference between them which we can conclude in the given points below:

S. No.

Transmission Control Protocol (TCP)

User Datagram Protocol (UDP)

1

It is connection-oriented protocol in which first connection is establish between the devices before the transmission begin.

It is connection-less protocol in which data is transmitted without any connection establish between the device.

2

It is reliable as it guarantees delivery of data to the destination router.

It is not reliable as there is no guarantee of delivery.

3

It has overhead.

It has no overhead.

4

Data is transmitted byte by byte format.

 Data is transmitted message stream format.

5

Sequencing of data is possible.

Sequencing of data is not possible.

6

It has flow control and error control mechanism.

It has only error control mechanism.

7

Retransmission of lost packets is possible.

Retransmission of lost packets is not possible.

8

It is comparably slower than UDP.

It is faster than TCP.

9

It is used by HTTP, FTP, SMTP and Telnet.

It is used by DNS, DHCP, RIP and VoIP.

 

The TCP Header format is shown in the figure 1. The key points are:




Figure 1: TCP Format

1.   Source Port and Destination Port: It contains the source and destination address of the transmitted data.

2.  Sequence Number (32 bits): It contains the order of the packets send to the destination. It helps to check the error control mechanism and retransmission in case of lost packets.

3.   Acknowledgement Number (32 bits):  It contains the value of the next sequence number that the sender of the segment is expecting to receive, if the ACK control bit is set.

4.    Header Length field(offset field): It tells how many 32-bit words are contained in the TCP header. 

5.    Flags field (6 bits):  It contains the various flags:
URG—
It Indicates that some urgent data has been placed.
ACK—It Indicates that acknowledgement number is valid.
PSH—
It Indicates that data should be passed to the application as soon as possible.
RST—
Resets the connection.
SYN—
It synchronizes sequence numbers to initiate a connection.
FIN—
It means that the sender of the flag has finished sending data.


6.    Window field (16 bits): It specifies the size of the sender's receive window (that is, buffer space available for incoming data).


7.    Checksum field (16 bits): It indicates whether the header contains the error bit or not.

8.    Urgent pointer field (16 bits): It points to the first urgent data byte in the packet.


9.    Options field (variable length): It specifies various TCP options.   


10. Data field (variable length): It contains upper-layer information.

 

The UDP format is shown in figure 2 as below: It contains

1.    Source Port ( 16 bit) : It is used to identify port number of source.


2.    Destination Port (16 bit): It is used to identify the port of destined packet.


3.    Length (16 bit): It is the length of UDP including header and the data. It is 16-bits field.

4.    Checksum (16 bit):  It is the 16-bit one’s complement of the one’s complement sum of the UDP header, pseudo header of information from the IP header and the data, padded with zero octets at the end to make a multiple of two octets. It is used for error control mechanism.



Figure 2: UDP Format





<<<<<<<<<<<<<<<How a website work?

Post a Comment

0 Comments