Hey! My answer is given below...to appreciate my work please
give Positive Feedback.............
Introduction
:--
TCP
:-
- The Transmission Control
Protocol (TCP) works on the third layer of this protocol model
which is the transport layer.
- TCP is a
connection-oriented protocol suite that ensures the delivery of
data packet to the next node or destination node by employing a
sequence number in each datagram and acknowledgment sessions with
each of the communication sessions.
- This system also ensures
secure transmission on each layer for the data packets and thereby
provisions the retransmission of data packets unless it reaches a
timeout situation or it receives the proper acknowledgment message
from the receiver.
UDP :--
- User Datagram Protocol
(UDP) is a Transport Layer protocol. UDP is a part of the Internet
Protocol suite, referred to as UDP/IP suite. Unlike TCP, it is an
unreliable and connectionless protocol. So, there is no need to
establish a connection prior to data transfer.
- Though Transmission
Control Protocol (TCP) is the dominant transport layer protocol
used with most of the Internet services; provides assured delivery,
reliability, and much more but all these services cost us with
additional overhead and latency.
- Here, UDP comes into the
picture. For realtime services like computer gaming, voice or video
communication, live conferences; we need UDP. Since high
performance is needed, UDP permits packets to be dropped instead of
processing delayed packets. There is no error checking in UDP, so
it also saves bandwidth.
- User Datagram Protocol
(UDP) is more efficient in terms of both latency and
bandwidth.
- User Datagram Protocol
(UDP) works on the transport layer which is the third layer of the
TCP/IP protocol suite. In contrast to the TCP protocol, it is a
connectionless protocol as it does not establish a connection
before sending the data over the network for
communication.
IP :--
- Internet Protocol being a layer-3 protocol (OSI) takes
data Segments from layer-4 (Transport) and divides it into packets.
IP packet encapsulates data unit received from above layer and add
to its own header information.
- The encapsulated data is referred to as IP Payload. IP
header contains all the necessary information to deliver the packet
at the other end.
- IP protocol is one of the main protocols in the TCP/IP
stack.
- It is in the form of IP datagrams that all the TCP,
UDP, ICMP and IGMP data travels over the network.
- IP is connection less and unreliable protocol. It is
connection less in the sense that no state related to IP datagrams
is maintained either on source or destination side and it is
unreliable in the sense that it not guaranteed that an IP datagram
will get delivered to the destination or not.
- If an IP datagram encounters some error at the
destination or at some intermediate host (while traveling from
source to destination) then the IP datagram is generally discarded
and an ICMP error message is sent back to the
source.
TCP Header
formate:-
The header of a TCP segment can range from 20-60 bytes.
40 bytes are for options. If there are no options, header is of 20
bytes else it can be of upmost 60 bytes.
TCP Header
fields:
- Source Port Address
– 16 bit field that holds the port address of the
application that is sending the data segment.
- Destination Port Address
– 16 bit field that holds the port address of the
application in the host that is receiving the data segment.
- Sequence Number
– 32 bit field that holds the sequence number, i.e,
the byte number of the first byte that is sent in that particular
segment. It is used to reassemble the message at the receiving end
if the segments are received out of order.
- Acknowledgement Number
– 32 bit field that holds the acknowledgement
number, i.e, the byte number that the receiver expects to receive
next. It is an acknowledgment for the previous bytes being received
successfully.
- Header Length (HLEN)
– This is a 4 bit field that indicates the length
of the TCP header by number of 4-byte words in the header, i.e, if
the header is of 20 bytes(min length of TCP header), then this
field will hold 5 (because 5 x 4 = 20) and the maximum length: 60
bytes, then it’ll hold the value 15(because 15 x 4 = 60). Hence,
the value of this field is always between 5 and 15.
- Control flags
–These are 6 bit long ,1-bit control bits that
control connection establishment, connection termination,
connection abortion, flow control, mode of transfer etc. Their
function is:
- URG: Urgent pointer is valid
- ACK: Acknowledgement number is valid( used in
case of cumulative acknowledgement)
- PSH: Request for push
- RST: Reset the connection
- SYN: Synchronize sequence numbers
- FIN: Terminate the connection
- Window size
– This field tells the window size of the sending
TCP in bytes.
- Checksum –
This field holds the checksum for error control. It is mandatory in
TCP as opposed to UDP.
- Urgent pointer
– This field (valid only if the URG control flag is
set) is used to point to data that is urgently required that needs
to reach the receiving process at the earliest.
- Options:--
This is a variable field. This can be set at the start of any of
the octet edge.
UDP Header
formate:-
Size of the header is 20 to 60
bytes.
- UDP header is an 8-bytes
fixed and simple header, while for TCP it may vary from 20 bytes to
60 bytes.
- The first 8 Bytes contains all necessary header
information and the remaining part consist of
data.
- UDP port number fields are each 16 bits long, therefore range
for port numbers defined from 0 to 65535; port number 0 is
reserved. Port numbers help to distinguish different user requests
or process.
- Source port: This
is 16 bits of length. It contains the value of the source port
employed by the source end for transferring the data packet. The
range lies between 0 to 65535.
- Destination port:
The size of this field is 16 bits. It contains the port number
which the destination host is expecting for receiving
data.
- Length: This field
size is 16 bits. It consists of the length size of the user
datagram, header, and data.
- Checksum: This is
also of 16 bit in size, but this is an optional field. It is used
for the computation of the errors in the datagram. If it is set to
zero, then checksum is not computed and if set to one then it will
be computed.
IP Header
formate(IPv4) :-
- VERSION:
Version of the IP protocol (4 bits),
which is 4 for IPv4
- HLEN:
IP header length (4 bits), which is
the number of 32 bit words in the header. The minimum value for
this field is 5 and the maximum is 15.
- Type of
service: Low Delay, High
Throughput, Reliability (8 bits)
- Total
Length: Length of header + Data
(16 bits), which has a minimum value 20 bytes and the maximum is
65,535 bytes.
- Identification:
Unique Packet Id for identifying the group of fragments of a single
IP datagram (16 bits)
- Flags:
3 flags of 1 bit each : reserved bit (must be zero), do not
fragment flag, more fragments flag (same
order)
- Fragment
Offset: Represents the number
of Data Bytes ahead of the particular fragment in the particular
Datagram. Specified in terms of number of 8 bytes, which has the
maximum value of 65,528 bytes.
- Time to
live: Datagram’s lifetime (8
bits), It prevents the datagram to loop through the network by
restricting the number of Hops taken by a Packet before delivering
to the Destination.
- Protocol:
Name of the protocol to which the data
is to be passed (8 bits)
- Header
Checksum: 16 bits header
checksum for checking errors in the datagram
header
- Source IP
address: 32 bits IP address of
the sender
- Destination IP
address: 32 bits IP address of
the receiver
- Option:
Optional information such as source
route, record route. Used by the Network administrator to check
whether a path is working or not.
COMPARISION BETWEEN TCP,IP and UDP
Header:-
TCP |
UDP
|
IP |
It has header Size is 20 bytes
long.
|
UDP header size is 8 bytes long
|
Size of the header is 20
to 60 bytes. |
TCP work on transport layer so it has
source and destination port of 16 bits long |
UDP also has source and destination port
of 16 bit long because it work on transport layer. |
IP works on the network layer so it has IP
source and destination address. which is virtual address use by
network layer. |
TCP has 16 fields in header formate. |
UDP has only 4 field , that make it easy
to understand. |
IP has 13 fields include optional field
(option) |
TCP provides reliable and
connection-oriented data transfer between the source and
destination. it has fields such as: sequence no, Acknolegement no,
window size and control flag fields. |
it has no such fields . it provide run
unreliable and connectionless data transfer between the source and
destination. |
IP is connection less and
unreliable protocol. It is connection less in the sense that no
state related to IP datagrams is maintained either on source or
destination side and it is unreliable in the sense that it not
guaranteed that an IP datagram will get delivered to the
destination or not. |
it has HLEN field . |
it has Length field . |
it has 2 length field HLEN(header) and
TOTAL Length(Total length of datagram). |
it provide flow control and error
correction using checksum field. it is mandatory filed. |
it doesn't provide flow control and error
detection using the checksum field. it is optional filed. |
it has Header Checksum |
it use IP for reliable and connection-oriented data transfer
between the source and destination.
|
it does not use IP packet for data
transfer it transfer the data in datagram formate |
IP use transport protocol such as TCP and
UDP for data transfer, for it it has type of service and protocol
field. |
- TCP and UDP are both transport layer protocols. TCP is
a connection orientated protocol and provides reliable message
transfer. UDP is a connection less protocol and does not guarantee
message delivery. and
- IP is connection less and unreliable protocol. It is
connection less in the sense that no state related to IP datagrams
is maintained either on source or destination side and it is
unreliable in the sense that it not guaranteed that an IP datagram
will get delivered to the destination or not.
- so, TCP is a connection orientated
protocol with built in error recovery and re transmission.
You can liken a TCP connection to a telephone
connection.
With a telephone connection you first need to setup the
connection by dialing the number, and once the calling party
answers you have a both way communications channel.
You then proceed to speak and once done you hang up the
connection.
With TCP you set up the connection using the 3 way
handshake .
-
so, that TCP has more Fields than UDP and
IP.
thanks...........