Professional Documents
Culture Documents
service: No logical connections, no flow or error control. Connection-oriented: Based on logical connections: connection setup, data transfer, connection teardown. Flow and error control. Reliability and in-order delivery.
TCP
Reliable end-to-end communication. Each machine supporting TCP has TCP
transport entity:
Features of TCP
Connection oriented: An application requests a
connection to destination and uses connection to transfer data
Delivering TCP
TCP at destination interprets TCP messages
sequence number. Data is exchanged in the form of segments. A segment consists of two sections: header (20 bytes plus optional part) data The TCP s/w decides how big the segments should be. Two limits restrict the segment size: Each segment must fit in the 65,535 byte IP payload. Each n/w has a maximum transfer unit (MTU) ,each segment must fit in the MTU.
Source port and Destination port -identify the local end points of the connection. Sequence number -This is used for representing the sequence number of the segment.(32 bit long) Acknowledgement number -If the ACK flag is set then the value of this field is the sequence number the sender expects next. The TCP Header Length This 4-bit field specifies the size of the TCP header in 32-bit words. The minimum size header is 20 bytes and the maximum is 60 bytes Reserved 6-bit reserved field for future use and should be set to zero.
Flags (Control bits) - This field contains 6 bit flags: URG - Set to 1 if Urgent pointer field is significant . ACK - Set to 1 if Acknowledgement field is significant ,if 0 ACK is ignored. PSH - This bit indicate PUSHed data-receiver is requested to deliver data to application upon arrival,not to buffer it. RST- Reset the connection-used to reject an invalid segment or refuse to open connection. SYN - Used to establish connections - denote connection request and connection accepted.(req is syn=1 & ack=0 and accept is syn=1 & ack=1) FIN - Used to release the connection-it specifies no more data from sender
Window size The number of bytes that may be sent. (ack=1 and window is 0 doesnt accept any more data.) Checksum The 16-bit checksum field is used for error-checking of the header and data.
Urgent pointer If the URG flag is set, then this 16-bit field is used to indicate a byte offset from the current sequence number at which the urgent data are to be found.
Option - Provide a way to add extra facilities. It allow each host to specify the maximum TCP payload it is willing to accept. Data The last field is not a part of the header.
UDP
Provides connection-less, unreliable service.
No delivery guarantees. No ordering guarantees. No duplicate detection. No connection establishment/teardown. Example: client-server applications.
Low overhead.
Both protocols support multiplexing, i.e. they allow several distinct streams of data between two hosts
TCP service:
connection-oriented: setup
UDP service:
unreliable data transfer
required between client and server processes reliable transport between sending and receiving process flow control: sender wont overwhelm receiver congestion control: throttle sender when network overloaded does not provide: timing, minimum bandwidth guarantees
between sending and receiving process does not provide: connection setup, reliability, flow control, congestion control, timing, or bandwidth guarantee
Host 1
SYN (SEQ=x)
) K=x+1 ,AC SEQ=y SYN(
Host 2
(SEQ=x+1, ACK=y+1)
TCP Transmission
Sender process initiates connection. Once connection established, TCP can start
sending data. Sender writes bytes to TCP stream. TCP sender breaks byte stream into segments. Each byte assigned sequence number. Segment sent and timer started. If timer expires, retransmit segment. After retransmitting segment for maximum number of times, assumes connection is dead and closes it.
How it works?
AT senders side: To establish a connection, one side, the server waits for an incoming connection by executing the LISTEN and ACCEPT primitive. The other side, the client executes a CONNECT primitive, specifying the IP address and port to which it wants to connect, the maximum TCP size its willing to accept and optionally some user data. The CONNECT primitive sends a TCP segment with the SYN bit on and ACK bit OFF & waits for a response.
At receivers side:
When this segment arrives at the destination, the
TCP entity there checks to see if there is a process that has done the LISTEN on the port given in the destination port field. If not then it sends a reply with RST bit on to reject the connection. If some process is listening to the port, the process is given the incoming TCP segment . It can either accept or reject the connection. If it accepts ,an acknowledgement segment is sent back.
Thank you.