You are here

TCP & UDP Protocol

Description of Basic Transfer Protocols used in Ethernet

Basic Transfer Protocols used in Ethernet are described bellow.

TCP Protocol

TCP provides reliability with a mechanism called Positive Acknowledgement with Retransmission (PAR). Simply stated, a system using PAR sends the data again, unless it hears from the remote system that the data arrived okay. The unit of data exchanged between co-operating TCP modules is called a segment

Click on me - I will enlarge myself in a new window, 
	so maximize me in that new window...

    The data segment format of the TCP Protocol.

  • Source port (16 bits): Specifies the port on the sending TCP module.
  • Destination port (16 bits):Specifies the port on the receiving TCP module.
  • Sequence number (32 bits):Specifies the sequence position of the first data octet in the segment. When the segment opens a connection, the sequence number is the Initial Sequence Number (ISN)
  • Acknowledgement number (32 bits):Specifies the next sequence number that is expected by the sender of the segment. TCP indicates that this field is active by setting the ACK bit, which is always set after a connection is established.
  • Data offset (4 bits): Specifies the number of 32-bit word in the TCP header.
  • Reserved (6 bits): Must be zero. Reserved for future use.
  • Control bits (6 bits) and the first octet in the data field is at sequence ISN+1
    • URG: When set, the Urgent Pointer field is significant
    • ACK :When set, the acknowledgement Number field is significant
    • PSH :Initiates a push function
    • RST :Forces a reset of the connection
    • SYN :Synchronises sequencing counters for the connection. This bit is set when a segment request opening of a connection.
    • FIN :No more data. Closes the connection
  • Window (16 bits): Specifies the number of octets, starting with the octet specified in the acknowledgement number field, which the sender of the segment can currently accept.
  • Checksum (16 bits): An error control checksum that covers the header and data fields. It does not cover any padding required to have the segment consists of an even number of octets. The checksum also covers a 96-pseudoheader, it includes source and destination addresses, the protocol, and the segment length. The information is forwarded with the segment to IP to protect TCP from miss-routed segments. The value of the segment length fields include the TCP header and data, but doesn't include the length of the pseudoheader.
  • Urgent Pointer (16 bits):Identifies the sequence number of the octet following urgent data. The urgent pointer is a positive offset from the sequence number of the segment.
  • Options (variable): Options are available for a variety of functions.
  • Padding (variable): 0-value octets are appended to the header to ensure that the header ends on a 32-bit word boundary.

Click on me - I will enlarge myself in a new window, 
	so maximize me in that new window...

The format of the TCP pseudoheader.

Each segment contains a checksum that the recipient uses to verify that the data is undamaged. If the data segment is received undamaged, the receiver sends a positive acknowledgement back to the sender. If the data segment is damaged, the receiver discards it. After an appropriate time-out period, the sending TCP module retransmits any segment for which no positive acknowledgement has been received.

TCP is connection-oriented. It establishes a logical end-to-end connection between the two communication hosts. Control information, called a handshake, is exchanged between the two endpoints to establish a dialogue before data is transmitted. TCP indicates the control function of a segment by setting the appropriate bit in the flags field of the segment header.

Click on me - I will enlarge myself in a new window, 
	so maximize me in that new window...

TCP establishes virtual circuits over which applications exchange data.

The type of handshake used by TCP is called a three-way handshake because three segments are exchanged.

Picture

Three-Way Handshake.

Reliability and Acknowledgement:

TCP employs the positive acknowledgement with retransmission technique for the purpose of archiving reliability in service.

Picture

The positive acknowledgement with retransmission technique.

With a laddergram depicting the events taking place between two hosts. The arrows represent transmitted data and/or acknowledgements, and time is represented by the vertical distance down the ladder. When TCP send a data segment, it requires an acknowledgement from the receiving end. The acknowledgement is used to update the connection state table. An acknowledgement can be positive or negative. An positive acknowledgement implies that the receiving host recovered the data and that it passed the integrity check. A negative acknowledgement implies that the failed data segment needs to be retransmitted. It can be caused by failures such as data corruption or loss.

Picture

How TCP implements a time-out mechanism to keep track of loss segments.

What happens when a packet is lost on the network and fails to reach its ultimate destination. When a host sends data, it starts a countdown timer. If the timer expires without receiving an acknowledgement, this host assumes that the data segment was lost. Consequently, this host retransmits a duplicate of the failing segment. TCP keep a copy of all transmitted data with outstanding positive acknowledgement. Only after receiving the positive acknowledgement is this copy discarded to make room for other data in its buffer.

Data Stream Maintenance:

The interface between TCP and a local process is a port, which is a mechanism that enables the process to call TCP and in turn enables TCP to deliver data streams to the appropriate process.

Ports are identified by port numbers. To fully specify a connection, the host IP address is appended to the port number. This combination of IP address and port number is called a socket. A given socket number is unique on the internetwork. A connection between two hosts is fully described by the sockets assigned to each end of the connection.

Click on me - I will enlarge myself in a new window, 
	so maximize me in that new window...

TCP Data Stream that starts with an Initial Sequence Number of 0.

The receiving system has received and acknowledged 2000 bytes. so the current Acknowledgement Number is 2000. The receiver also has enough buffer space for another 6400 bytes, so it has advertised a Window of 6000. The sender is currently sending a segment of 1000 bytes starting with Sequence Number 4001. The sender has received no acknowledgement for the bytes from 2001 on, but continues sending data as long as it is within the window. If the sender fills the window and receives no acknowledgement of the data previously sent, it will, after an appropriate time-out, send the data again starting from the first unacknowledged byte. Retransmission would start from byte 2001 if no further acknowledgements are received. This procedure ensures that data is reliably received at the far end of the network.

UDP Protocol

NFS and NIS are build on top of UDP because of its speed and statelessness. While the performance advantages of a fast protocol are obvious, the stateless nature of UDP is equally important. Without state information in either the client or server, crash recovery is greatly simplified.

Click on me - I will enlarge myself in a new window, 
	so maximize me in that new window...

The UDP Datagram Format.

  • Source Port (16 bits):This field is optional and specifies the port number of the application that is originating the user data.
  • Destination Port (16 bits):This is the port number pertaining to the destination application.
  • Length (16 bits): This field describes the total length of the UDP datagram, including both data and header information.
  • UDP checksum (16 bits):Integrity checking is optional under UDP. If turned on, this field is used by both ends of the communication channel for data integrity checks.

Click on me - I will enlarge myself in a new window, 
	so maximize me in that new window...

The relationship between UDP and IP headers.

There are two points to make:
  • What IP considers to be data field is in fact another piece of formatted information including both UDP header and user protocol data. To IP it should not matter what the data field is hiding.

  • The details of the header information for each protocol should clearly convey to the reader purpose of the protocol.

fandikh@hotmail.com
More info at

  Picturehttp://www.citap.com/documents/tcp-ip/tcpip012.htm

 

  Picturehttp://www.citap.com/documents/tcp-ip/tcpip014.htm

 

  Picturehttp://www.cs.huji.ac.il/support/docs/tcp/subsection3.2.1.html

 

  Picturehttp://www.cs.huji.ac.il/support/docs/tcp/section3.4.html

 

  Picturehttp://www.citap.com/documents/tcp-ip/tcpip015.htm

Hodnocení článku: