1 / 34

Transmission Control Protocol (TCP)

Transmission Control Protocol (TCP). The scope of TCP. TCP is an end-to-end protocol, it seeks to compensate for network degradations over the entire path from A to B. Especially it does not run in routers or any other network equipment. The position of TCP in the protocol Stack.

Download Presentation

Transmission Control Protocol (TCP)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Transmission Control Protocol (TCP)

  2. The scope of TCP TCP is an end-to-end protocol, it seeks to compensate for network degradations over the entire path from A to B. Especially it does not run in routers or any other network equipment.

  3. The position of TCP in the protocol Stack.

  4. The services provided by TCP in the protocol stack. • TCP sets up end-to-end connections. It is connection oriented. • It associates peer communicating processes via a port number • It does both error control and flow control • At the source, it fragments messages from higher layers into segments, • and passes them to IP for delivery. • At the destination, after delivery it reassembles the segments, possibly • having to re-sequence them. • TCP attempts to optimise throughput on a connection

  5. Structure of a TCP Segment

  6. A very important role of TCP is to identify the processes that are in communication. It does this through the port number.

  7. Transmission Control Protocol (TCP) • A transport layer protocol, operates end-to-end. Does not run in • network nodes, i.e routers or switches. It establishes connections • between clients and servers, connections are full duplex. • The purpose of any transport layer is to compensate for network • degradation of user messages. E.g loss, flow control, mis-sequencing of • packets. It does segmentation of user messages for sending purposes, and • it re-assembles the received messages at the destination. It also attempts to • achieve high throughput on a connection. • Another candidate transport layer protocol is the User Datagram • Protocol (UDP). UDP is considered a lightweight protocol in • comparison to TCP, it incurs less overhead. More suited to some • applications, i.e voice over IP, streaming audio or video. • All data sent over TCP is considered as a byte stream. No other • structure or boundary is observed by TCP. Start and end of Data • base records are the responsibility of the DBMS/Application.

  8. The TCP Protocol is modelled on the client server structure, one process is the client, while the other is the server. But any process can assume the role of client or server.

  9. In this example, application Y has 2 transport connections open. TCP may open more than one connection if the rate at which the application generates packets is overflowing its send buffer. With more thanone connection a higher bandwidth is available to the application.

  10. Addressing via Port Numbers to identify communicating Processes Port numbers from 0 to 1023 are reserved, and are called well known ports. e.g Well known Port Numbers: FTP 20 and 21 SMTP 25 Http 80 Telnet 23 TFTP 69 (UDP) etc DNS 53 A TCP connection between client and server is identified by a 5 tuple: (<client IP addr, client TCP port #>, <server IP addr, server TCP port #>, Protocol=TCP)

  11. In order to associate a process on the source machine with a process • on the destination machine, TCP can be used. (IP identifies the source • and destination machines only via an IP address). The source process is • identified by a source ‘port number’, while the destination process is • identified by a ‘destination port number’. • TCP is the prime example of a transport protocol. Used with IP. It • compensates for the shortcomings of IP, e.g it is connection oriented, • it does error recovery, it performs flow control, and it does resequencing • of packets when necessary. • TCP messages (segments) are encapsulated in IP packets. Every TCP • message contains a source and destination port number. • The combination machine IP address together with the TCP port • number is called the ‘transport address’of the connection. • Connections are point to point.

  12. HTTP

  13. Bandwidth x RTT Product The bandwidth times the Round Trip Time gives an idea of the number of bits that the sender can transmit before expecting an acknowledgement back from the receiver. Given the frame size, then it can be converted to the number of frames that the sender can transmit before expecting an ack. Determines the batch size for pipelined protocols. It also determines the time the receiver has to wait for a retransmitted frame from the time the Nak was sent out. RTT is difficult to measure. It consists of propagation latency, plus processing time at the receiver. Over an end-to-end path, delays at the intermediate packet switching nodes affects the RTT. RTT will vary with network congestion.

  14. The average RTT over the last k+1 segments is: ARTT(k+1) = 1/(k+1)  RTTi summed over the last k+1 RTTs. This can be re expressed as: ARTT(k+1) = k / (k+1) ARTT(k) + 1 / (k+1) RTT(k+1). This shows how the moving average over the last k+1 samples can be calculated, knowing the average over the last k samples. This makes the calculation efficient. An alternative is the give more weight (rather than same as above) to the most recent RTT. This is done via the smoothed RTT based on exponential averaging, viz: SRTT(k+1) =  SRTT + (1-) RTT(k+1)

  15. This shows the situation after the timer, corresponding to the lost frame expires. Notice the returned ack of 38,500, it automatically acknowledges the previous 3 messages

  16. Server Client The ‘Window’ in each TCP segment does not reflect any congestion that may exist along the path from client to server. To account for possible congestion of routers within the network, TCP defines a ‘congestion window’ cwnd.

  17. TCP options • A timestamp option • Because every network has unique latency characteristics, TCP has to understand these • characteristics in order to set accurate acknowledgment timer threshold values. LANs typically • have very low latency times, and as such TCP can use low values for the acknowledgment • timers. If a segment is not acknowledged quickly, a sender can retransmit the questionable data • quickly, thereby minimizing any lost bandwidth. However, using a low threshold value on a • WAN is sure to cause problems because the acknowledgment timers likely will expire before • the original data ever reaches the destination. Therefore, in order for TCP to accurately set the • timer threshold value for a virtual circuit, it has to measure the round-trip delivery times for • various segments. Furthermore, it has to monitor additional segments throughout the connection's • lifetime to keep up with changes in the network. • It's important to note that the data provided in the timestamp field is only used by the system • that wrote the data into the field in the first place. The Timestamp option is not meant to provide • any form of time synchronization. Rather, it is meant to act as a simple stopwatch for each • system, allowing them to measure the amount of time required to send and receive a segment • across a particular network. (This option could be used to set the retransmission timer more accurately. On LANs the retransmission timer can be set more easily than on WAN routes.)

  18. 2. Selective Acknowledgments One of the more common complaints about TCP is that it uses a cumulatively implicit acknowledgment scheme (as opposed to an explicit one), suggesting that all data up to the sequence number specified in the Acknowledgment Identifier field has been received. Once a sender has received an acknowledgment, it can assume that all data sent up to that point has been received successfully. Conversely, if a sender receives multiple acknowledgments for the same byte of data, then it must assume that any data sent after that point has been lost. Although this works very well when data is flowing smoothly, the lack of a detailed acknowledgment scheme prevents quick recovery when one segment from a batch is lost in transit. There are no mechanisms for a receiver to state "I'm still waiting for bytes N through P, but have received bytes Q through Z." If segments arrive out of order and there's a hole in the receiver's queue, the only thing it can do is keep saying "I got everything up to N." The sender has to recognize that the presence of multiple duplicate acknowledgments indicates a problem, and then resume transmitting data from that point. The Selective Acknowledgment option is used to supplement the existing Acknowledgment Identifier field that is present in every TCP header. If a recipient has a hole in the data it has received, it issues a segment with the Acknowledgment Identifier field pointing to the last cumulative byte of data received, while the Selective Acknowledgment option points to any additional blocks of data that it has also received after the missing data. The original sender of the data can then examine the Acknowledgment Identifier field and the Selective Acknowledgment option, determine which block of data was lost in transit and then send only that segment, resuming transfer from the high watermark specified by the Selective Acknowledgment option. (This corresponds with the ‘selective repeat’ mode )

  19. 3. Window Scale. In each segment’s header there is a 16 bit window field, specifying at most a total of 64Kbytes that can be received by the issuing side. On high latency WAN links, it could happen that the entire 64Kbytes could be sent, before any acknowledgement arrives, in which case the sender must stop transmitting to await an acknowledgement. An option exists to expand the window size by allocating additional bits, (up to 14 max). With 14 additional bits, there is scope to transmit up to 230 bytes, (i.e 1GB) of data. 4. Maximum Segment Size (MSS). This option exists, and is frequently used at setup time, to set a maximum segment size to suit both parties.

  20. Conclusions. • TCP is connection oriented. Connection parameters are negotiated at • set-up time • TCP is a widely used transport layer protocol. It is designed to be • used with IP. It detects transmission errors, and recovers via • retransmissions. It is a Positive Acknowledgement with • Retransmission (PAR) algorithm. No negative acks, rely on timeout. • TCP performs flow control via the ‘window’ mechanism. • TCP segments user messages, passes the segments to IP for outward • transmission. At the receiver, TCP re-assembles the segments into • the original user message. • Uses source and destination port numbers to identify the • communicating processes. • TCP monitors throughput on a connection, and adapts its congestion • window accordingly • Attempts to achieve high throughput on connections

  21. User Datagram Protocol (UDP) UDP is an alternative transport layer protocol. It is connectionless, provides an unreliable service, delivery and duplicate prevention are not guaranteed. It is a much lighter-weight protocol than TCP. Essentially what UDP provides is the identification of the communicating processes via the port numbers. The checksum in the header is optional. If used then it protects the entire UDP datagram, and its calculation takes in the IP header as well. It is the same algorithm as in TCP. If not used the field is set to zeros. UDP messages that fail the checksum are discarded silently. A connectionless service is appropriate in some circumstances. Network management traffic, network monitoring, distribution of data, streaming audio and video, and VOIP. The length field specifies the size of the entire segment. UDP is the transport protocol of choice for streaming audio and video services over IP networks, and for VOIP telephony. The checksum in UDP is over the header and data part. Same in TCP. Checksum calculation in UDP is optional.

More Related