1 / 78

Chapter 12 Transmission Control Protocol

Chapter 12 Transmission Control Protocol. Prof. Choong Seon HONG. Introduction. Position of TCP. Introduction (cont’d). Responsibilities of Transport Layer to create a process-to-process communication using port numbers in case of TCP

newsomej
Télécharger la présentation

Chapter 12 Transmission Control Protocol

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. Chapter 12 Transmission Control Protocol Prof. Choong Seon HONG

  2. Introduction • Position of TCP

  3. Introduction (cont’d) • Responsibilities of Transport Layer • to create a process-to-process communication • using port numbers in case of TCP • to provide a flow-and-error control mechanism at the transport level • TCP uses sliding window protocol to achieve error control. • TCP uses the acknowledgment packet, time-out, and retransmission to achieve error control. • to provide a connection mechanism for the application program • sending streams of data to the transport layer by application program • making a connection with the receiver, chopping the stream into transportable units, numbering them and sending them one by one

  4. Introduction (cont’d) • At the receiving end, waiting until all the different units belonging to same application program have received, checking, passing those that are error free and delivering them to the receiving application program as a stream. • After the entire stream has been sent, the transport layer should close the connection. • TCP is called a connection-oriented, reliable transport protocol • adding connection-oriented and reliability features to the services of IP

  5. 12.1 Process-to-Process Communication • Host-to-host communication and process-to-process communication

  6. Process-to-Process Communication (cont’d) • Port Addresses (Numbers) • process-to-process communication that achieved through the client/server paradigm • to define the client and server programs, we need second identifiers called port numbers. • integers between 0 and 65,535 • The client program running on the local computer defines itself with a port number, chosen randomly by the TCP software running on the local host • using a ephemeral port number • But, the server program on the remote computer must also define itself with a port number • using a well-known port number

  7. Process-to-Process Communication (cont’d) • Explanation of port numbers using TENET application

  8. Process-to-Process Communication (cont’d) • Well-known ports used by TCP

  9. Process-to-Process Communication (cont’d) • Socket Addresses • To make a connection, • needs 2 identifier : IP address + Port number  Socket address • a pair of socket address • Client socket address • Server socket address

  10. 12.2 TCP Services • Stream Delivery Service • TCP is a stream-oriented protocol • TCP creates an environment in which the two processes seem to be connected by an imaginary “tube” that carries their data across the Internet.

  11. TCP Services (cont’d) • Sending and Receiving Buffers • Because the sending and receiving processes may not produce and consume data at the at the same speed, TCP needs buffers for storage. • One way to implement is to use a circular array Not acknowledged

  12. TCP Services (cont’d) • Segments

  13. TCP Services (cont’d) • Stream Data Service (stream transport layer service) • The sending TCP 1) accepts a stream of characters from sending application program 2) creates packets called segments, of appropriate size extracted from the stream 3) sends segments across the network • The receiving TCP 1) receives segments, extracts data from segments 2) orders segments if they have arrived out of order 3) delivers segments as a stream of characters to the receiving application program

  14. TCP Services (cont’d) • For stream delivery, • the sending and receiving TCPs use buffers • the sending TCP uses sending buffer to store the data coming from the sending application program. • the sending application program writes data to the buffer of the sending TCP • the receiving TCP receives the segments and stores them in a receiving buffer • the receiving application program uses the read operation to read the data from the receiving buffer. • Since the rate of reading can be slower than the rate of receiving, the data is kept in the buffer until the receiving application reads it completely.

  15. TCP Services (cont’d) • Full-Duplex Service • TCP offers full-duplex service • After two application programs are connected to each other, they can both send and receive data. • Piggybacking • When a packet is going from A to B, it can also carry an acknowledgment of the packets received from B • Reliable Service • TCP uses the acknowledgment mechanism to check the safe and sound arrival of data

  16. 12.3 Segment • The Unit of data transfer between two devices using TCP is a segment • The format of a segment

  17. Segment (cont’d) • Source port address • defining the port number of application program in the host that is sending the segment • Destination port address • defining the port number of application program in the host that is receiving the segment • Sequence number • defining the number assigned to the first byte of data contained in this segment • during the connection establishment, each party uses a random number generator to create an initial sequence number (ISN)

  18. Segment (cont’d) • Acknowledgment number • If the source of the segment has successfully received byte number x from the other party, it defines x+1 as the acknowledgment number • Header length • Indicating the number of 4-byte words in the TCP header • the value between 5 and 15 (20 and 60 bytes) • Reserved • For future use

  19. Segment (cont’d) • Control • Enabling flow control, connection establishment and termination, and mode of data transfer in TCP

  20. Segment (cont’d) • Description of flags in the control field

  21. Segment (cont’d) • Window size • defining the size of the window, in bytes, that the other party must maintain. • maximum size of window : 65,535 bytes • Checksum : see section 12.5 • Urgent pointer • used when the segment contains urgent data • defining the number that must be added to the sequence number to obtain the number of the last urgent byte in the data section of the segment • Options : 40 bytes

  22. 12.4 Options • Used to convey additional information to the destination or to align other options • Two categories of options • one-byte options • multiple-byte options

  23. Options (cont’d) • End of option • After this option, the receiver looks for the payload data • End of options imparting 3 pieces of information to the destination • No more options in the header • The remainder of the 32-bit word is garbage • Data from the application program starts at the beginning of the next 32-bit word

  24. Options (cont’d)

  25. Options (cont’d) • No operation • One-byte option used as a filler between options

  26. Options (cont’d) • Maximum segment size (MSS) • defining the size of the biggest chunk of data that can be received by the destination of the TCP segment • in spite of its name, defining the maximum size of the data, not the maximum size of the segment • value of 0 to 65,535 bytes : default is 536 • to be determined during the connection establishment phase by the destination of the segment • used only in the segments that make the connections. Not used in the segments during data transfer

  27. Options (cont’d) • Window scale factor • defining the size of the sliding window • new window size = window size defined in the header x 2 window scale factor • Determined in phase of the connection setup • The largest value of scale factor allowed by TCP/IP is 16.

  28. Options (cont’d) • Timestamp • 10-byte option • The timestamp field is filled by the source when the segment leaves. • When the destination sends an acknowledgment for the bytes in that segment, the destination enters the previously stored value in the echo reply field. • The source, when it receives the acknowledgment, checks the current time versus this value • The difference is the round-trip time.

  29. 12.5 Checksum • The inclusion of the checksum in TCP is mandatory.

  30. 12.6 Flow Control • Defining the amount of data that a source can send before receiving an acknowledgement from the destination. • Sliding window • For flow control, TCP uses a sliding window protocol • The window covers a portion of the buffer that a host can send before worrying about an acknowledgment from other host

  31. Flow Control (Cont’d) • Sliding window • Before receiving any acknowledgment from the destination the source can send up to 10 bytes

  32. Flow Control (Cont’d) • Sliding window with pointer

  33. Flow Control (Cont’d) • Window size in TCP is variable • the size of the window can be increased or decreased depending on the advertisement by the destination • Increasing the Window Size (depending on the advertisement by the destination)

  34. Flow Control (Cont’d) • Decreasing the Window Size (depending on the advertisement by the destination)

  35. Flow Control (Cont’d) • Window management • TCP uses two buffers and one window to control the flow of data. • The size of the window in the sending TCP is determined by the receiver and is announced in the ACK segments. • usually the space left over in the receiving TCP buffer

  36. Flow Control (Cont’d)

  37. 12.7 Error Control • Including mechanisms for detecting corrupted segments, lost segments, out-of-order segments, and duplicated segments. • Also, including a mechanism for correcting errors after they are detected. • Error Detection and Correction • Checksum • Acknowledgment : TCP does not use negative acknowledgment • Time-out

  38. Error Control (Cont’d) • Corrupted Segment

  39. Error Control (Cont’d) • Lost Segment

  40. Error Control (Cont’d) • Duplicate Segment • can be created by a source TCP when the acknowledgment does not arrive before the time-out. • Out-of-Order Segment • Because of IP datagrams

  41. Error Control (Cont’d) • Lost Acknowledgment

  42. 12.8 TCP Timers • To perform its operation smoothly, TCP uses the 4 timers

  43. TCP Timers (Cont’d) • Retransmission Timer • To control a lost or discarded segment, when TCP sends a segment, it creates a retransmission timer for that particular segment. • Calculation of Retransmission Time • TCP uses the dynamic retransmission time-out that is different for each connection and which may be changed during the same connection • Retransmission time = 2 x RTT • Calculation of RTT : use of Timestamp option and Timer in sending TCP

  44. TCP Timers (Cont’d) • The value of RTT used in the calculation of the retransmission time of the next segment RTT =  x previous RTT +(1 -  )current RTT where,  is usually 90 % • Persistence Timer • When acknowledgment with non-zero window size after zero window size is lost, to correct deadlock, TCP uses a persistence timer for each connection • When the sending TCP receives an acknowledgment with a window size of zero, the persistence timer is started • When persistence timer goes off, the sending TCP sends a special segment called a probe

  45. TCP Timers (Cont’d) • Persistence Timer (cont’d) • The probe alerts the receiving TCP that the acknowledgment was lost and should be resent. • If a response is not received, the sender continues sending the probe segments and doubling, and resetting the value of the persistence timer until the value reaches a threshold (usually 60 seconds). • KeepaliveTimer • Used to prevent a long idle connection between two TCPs. • Each time the server hears from a client, it resets this timer. • Time-out is usually 2 hours. • After 2 hours, sending 10 probes to client (each 75 secs), then terminates connection.

  46. 12.9 Connection • A connection-oriented protocol establishes a virtual path between the source and destination using two procedures : • connection establishment • connection termination • Connection Establishment • TCP transmits data in full-duplex mode. • 4 functions between host A and host B • Host A sends segment to announce its wish for connection and includes its initialization information about the traffic from A to B • Host B sends a segment to acknowledge (confirm) the request of A • Host B sends a segment that includes its initialization information about the traffic from B to A • Host A sends a segment to acknowledge (confirm) the request of B can be combined into one step

  47. Connection (cont’d) • Three-way Handshaking • Passive Open • The sever program tells its TCP that it is ready to accept a connection • It means that although its TCP is ready to accept any connection from any machine in the world it cannot make the connection itself. • Active Open • A client that wishes to connect to a server tells its TCP that it needs to be connected to a particular server.

  48. Connection (cont’d) • Three-way Handshaking Procedures

  49. Connection (cont’d) 1. The client sends the first segment, a SYN segment. • Including the source and destination port numbers, and client initialization sequence number (ISN) used for numbering the bytes of data sent from the client to the server • Defining the wish of the client to make a connection with certain parameters. 2. The server sends the second segment, a SYN and ACK segment • Including the ACK of receipt of the first segment • The server must define also the client window size • Used as the initialization segment for the server • Containing the window scale factor option (if needed) to be used by the server and the MSS defined by the server

  50. Connection (cont’d) 3. ACK segment • Acknowledging the receipt of the second segment using the ACK flag and acknowledgment number field. • Client must also define the server window size.

More Related