Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 12 Transmission Control Protocol (TCP). Outline  PROCESS-TO-PROCESS COMMUNICATION  TCP SERVICES  NUMBERING BYTES  FLOW CONTROL  SILLY WINDOW.

Similar presentations


Presentation on theme: "Chapter 12 Transmission Control Protocol (TCP). Outline  PROCESS-TO-PROCESS COMMUNICATION  TCP SERVICES  NUMBERING BYTES  FLOW CONTROL  SILLY WINDOW."— Presentation transcript:

1 Chapter 12 Transmission Control Protocol (TCP)

2 Outline  PROCESS-TO-PROCESS COMMUNICATION  TCP SERVICES  NUMBERING BYTES  FLOW CONTROL  SILLY WINDOW SYNDROME  ERROR CONTROL  TCP TIMERS

3 Outline (Cont.)  CONGESTION CONTROL  SEGMENT  OPTIONS  CHECKSUM  CONNECTION  STATE TRANSITION DIAGRAM  TCP OPERATION  TCP PACKAGE

4 Figure 12-1 Position of TCP in TCP/IP Protocol Suite The McGraw-Hill Companies, Inc., 2000

5 Introduction  Transport layer functionality Create a process-to-process communication  Port numbers by TCP Create a flow and error-control mechanism at the transport layer  For flow control: TCP uses a sliding window protocol  For error control: TCP uses the acknowledge packet, time-out, and retransmission mechanisms

6 PROCESS TO PROCESS COMMUNICATION 12.1 The McGraw-Hill Companies, Inc., 2000

7 Figure 12-2 TCP versus IP The McGraw-Hill Companies, Inc., 2000

8 Port Number  Client ’ s port number Chosen randomly by the TCP software running on the local host Called ephemeral port number  Server ’ s port number Define itself with a port number Called well-known port numbers

9 Figure 12-3 Port Numbers The McGraw-Hill Companies, Inc., 2000

10 Well-Know Ports Used by TCP PortProtocolDescription 7EchoEchoes a received datagram back to the sender 9DiscardDiscards any datagram that is received 11UsersActive users 13DaytimesReturn the data and the time 17QuoteReturn a quote of the day 19ChargenReturn a string of characters 20FTP, DataFile Transfer Protocol (data connection) 21FTP, DataFile Transfer Protocol (control connection)

11 Well-Know Ports Used by TCP PortProtocolDescription 23TelnetTerminal Network 25SMTPSimple Mail Transfer Protocol 53DNSSimple Mail Transfer Protocol 67BOOTPBootstrap 79Finger 80HTTPHypertext Transfer Protocol 111RPCRemote Protocol Call

12 Socket Addresses  Socket address The combination of IP address and port number

13 TCP SERVICES 12.2 The McGraw-Hill Companies, Inc., 2000

14 TCP Services  TCP provides services to the processes at the application layer Stream Delivery Service Full-Duplex Service Connection-Oriented Service Reliable Service

15 Stream Delivery Service  UDP treats each chunk independently No any connection between the chucks  In contrast, TCP allow the data be delivered/received as a stream of bytes

16 Figure 12-4 Stream Delivery The McGraw-Hill Companies, Inc., 2000

17 Stream Delivery Service (Cont.)  However, the sending and receiving speed may not be the same TCP needs buffers for storage  Two buffers in TCP Sending buffer and receiving buffer Also used in flow- and error-control mechanisms

18 Figure 12-5 Sending and Receiving Buffers The McGraw-Hill Companies, Inc., 2000

19 Sending Buffers  The sending circular buffer has three types of sections White section: empty location  Can be filled by the sending process Gray section: hold bytes that have been sent but not yet acknowledged  TCP keeps these bytes until it receives acknowledges Color section: bytes to be sent by the sending TCP  TCP may be able to send only part of this colored section The slowness of the receiving process The congestion in the network

20 Receiving Buffer  The receiving circular buffer is divided into two areas White area:  Empty locations to be filled Colored area:  Contain received bytes that can be consumed by the receiving process

21 Segments  TCP groups a number of bytes together into a packet called a segment TCP adds a header to each segment Then, the segments are encapsulated in an IP datagram

22 Figure 12-6 TCP Segments The McGraw-Hill Companies, Inc., 2000

23 Full-Duplex Service  TCP offers full-duplex service Data can flow in both directions at the same time Each TCP has a sending and receiving buffer and segments are sent in both direction

24 Connection-Oriented Service  TCP is a connection-oriented protocol However, the connection is virtual, not a physical connection Each TCP segment may use a different path to reach the destination

25 Reliable Service  TCP uses an acknowledge mechanism to check the safe and sound arrival of data

26 NUMBERING BYTES 12.3 The McGraw-Hill Companies, Inc., 2000

27 Numbering Bytes  TCP uses sequence number and acknowledgement number to keep track of the segment being transmitted or received Notably, these two fields refer to the byte number, not the segment number

28 Byte Numbers  TCP numbers all data bytes that are transmitted in a connection  The numbering does not necessarily start from 0 It starts randomly Between 0 and 2^32 – 1 for the number of the first byte Byte numbering is used for flow and error control

29 The bytes of data being transferred in each connection are numbered by TCP. The numbering starts with a randomly generated number. The McGraw-Hill Companies, Inc., 2000

30 Sequence Number  TCP assigns a sequence number to each segment that is being sent  The sequence number for each segment is the number of the first byte carried in that segment

31 The value of the sequence number field in a segment defines the number of the first data byte contained in that segment. The McGraw-Hill Companies, Inc., 2000

32  Imagine a TCP connection is transferring a file of 6000 bytes. The first byte is numbered 10010  What are the sequence numbers for each segment if data is sent in five segments with The first four segments carrying 1,000 bytes The last segment carrying 2,000 bytes? Example 1

33 Solution The following shows the sequence number for each segment: Segment 1  10,010 (10,010 to 11,009) Segment 2  11,010 (11,010 to 12,009) Segment 3  12,010 (12,010 to 13,009) Segment 4  13,010 (13,010 to 14,009) Segment 5  14,010 (14,010 to 16,009) The McGraw-Hill Companies, Inc., 2000

34 Acknowledgment Number  Communication in TCP is full duplex Both parties can send and receive data at the same time in a connection  Each party numbers the bytes, usually with a different starting byte number Sequence number: the number of the first byte carried by the segment Acknowledgment number: the number of the next byte that the party expects to receive

35 Acknowledgment Number (Cont.)  Acknowledgment number is cumulative  For example, if a party uses 5,643 as an acknowledgment number It has received all bytes from the beginning up to 5,642 Note that, this does not mean that the party has received 5642 bytes  The first byte number does not have to start from 0

36 The value of the acknowledgment field in a segment defines the number of the next byte a party expects to receives. The acknowledgment number is cumulative. The McGraw-Hill Companies, Inc., 2000

37 FLOW CONTROL 12.4 The McGraw-Hill Companies, Inc., 2000

38 Flow Control  The amount of data a source can send before receiving an acknowledgment  Two extreme cases Send 1 byte of data and wait for an acknowledge  Source would idle most of the time Send all of the data without worrying about acknowledgment  May overwhelm the receiver  Inefficient if some part of data is lost, duplicated, received our of order or corrupted  Solution: the sliding window protocol by TCP

39 Sliding Window Protocol  Both hosts use a window for each connection Containing bytes that a host can send before worrying about an acknowledgment  Called sliding windows The window can slide over the buffer  TCP’s sliding windows are byte oriented

40 A sliding window is used to make transmission more efficient as well as to control the flow of data so that the destination does not become overwhelmed with data. TCP’s sliding windows are byte oriented. The McGraw-Hill Companies, Inc., 2000

41 Sending Buffer  Bytes before 200 The sender can reuse these locations  Bytes 200 to 202 Sender must keep these bytes in cases they are lost or damaged

42 Receiver Window  Receiver window If the total size of the receiving buffer is N M locations are already occupied Then, N-M more bytes can be received Receiver windows = N – M  Example: N = 13, M = 6, receiver windows = 7

43 Sender Window  Sender window A size less than or equal to the size of the receiver window  For example Sender window = receiver window But, sender can send only 4 more bytes because it has already sent 3 bytes

44 Sliding the Sender Window  Sender sends 2 more bytes and an ack. is received (expecting byte 203)  Thus, the receiver window ’ s size is unchanged

45 Expanding the Sender Window  If the receiving process consumes data faster than it receives The size of the receiver window expands  Because the buffer has more free locations This situation can be relayed to the sender  Sender window size is also increased  Example Receiver has acknowledged the receipt of 2 more bytes Receiver also increases its window size to 10 Thus, the sender window is also updated accordingly

46 Figure 12-11 Expanding the Sender Window The McGraw-Hill Companies, Inc., 2000

47 Shrinking the Sender Window  If the receiving process consumes data slower than it receives The size of the receiver window decreases The receiver has to inform the sender to shrink its sender window size  For example The receiver has received the 5 bytes (205~509) The receiver ’ s window size is decrease to 6

48 Figure 12-12 Shrinking the Sender Window The McGraw-Hill Companies, Inc., 2000

49 Closing the Sender Window  If the receiver buffer is totally full The receiver window value is zero  When this is relayed to the sender The sender closes its window The sender cannot send any more data

50  In TCP, the sender window size is totally controlled by the receiver window value  However, the actual window size can be smaller if there is congestion in the network

51  Some Points about TCP ’ s Sliding Windows The source does not have to send a full window ’ s worth of data The source does not have to send a full window ’ s worth of data The size of the window can be increased or decreased by the destination The size of the window can be increased or decreased by the destination The destination can send an acknowledgment at any time The destination can send an acknowledgment at any time

52 SILLY WINDOW SYNDROME 12.5 The McGraw-Hill Companies, Inc., 2000

53 Silly Window Syndrome  Problem in the sliding window operation The sending process creates data slowly Or the receiving process consume data slowly Or both Result in the sending of data in very small segment  Reduce the network efficiency  For example, send a one byte segment result in overhead of 41/1 Assume TCP header is 20 bytes + IP header is 20 bytes

54 Syndrome Created by the Sender  Sender application create data too slowly For example, only 1 byte at a time Sending TCP would create segments containing 1 byte of data  Solution: prevent the sending TCP from sending the data byte by byte Sending TCP must be forced to wait as it collects data to send in a larger block But, how long should the sending TCP wait?

55 Nagle ’ s Algorithm  Nagle found the solution to above syndrome The sending TCP sends the first piece of data it receives from the sending application  Even if it is only 1 byte After sending the first segment, the sending TCP accumulates data in the buffer and wait until  Either the receiving TCP sends an acknowledge  Or until enough data has accumulated to fill a maximum-size segment Step 2 is repeated. Segment 3 is sent if an acknowledgment is received for segment 2 or enough data is accumulated to fill a maximum-size segment

56 Nagle ’ s Algorithm (Cont.)  Elegance Very simple Take into account the speed of the application that creates the data and the speed of the network that transports the data  If application is faster than the network The segments are larger  If the application is slower than the network The segment are smaller

57 Syndrome Created by the Receiver  The receiving TCP may also create a silly window syndrome If it is serving an application that consumes data slowly  For example Sender application create data in 1K byte blocks But the receiving application consumes data 1 byte at a time Assume the sender buffer is 4K bytes  Buffer will be full soon  Sender then only can send 1 byte data to the receiver

58 Syndrome Created by the Receiver (Cont.)  Solution Clark ’ s solution Delayed acknowledgment

59 Clark ’ s Solution  Send an acknowledgment as soon as the data arrives but to announce a window size of zero until Either there is enough space to accommodate a segment of maximum size Or half of the buffer is empty

60 Delayed Acknowledgment  Delay sending the acknowledgment When a segment arrives, it is not acknowledged immediately Receiver waits until there is a decent amount of space in its incoming buffer  Delayed acknowledgment prevents the sending TCP from sliding it window

61 Delayed Acknowledgment (Cont.)  Another advantage Reduce traffic The receiver does not have to acknowledge each segment  Disadvantage The sender may retransmit the unacknowledged segment  Solution Defines the acknowledgment should not be delayed by more than 500 ms

62 ERROR CONTROL 12.6 The McGraw-Hill Companies, Inc., 2000

63 Error Control  TCP provides reliability using error control Detect corrupted segment, lost segment, out-of- order segment, and duplicated segment Error control in TCP also correct error after they are detected

64 Error Detection and Correction  Error detection in TCP is achieved by Checksum Acknowledgment Time-out  Error correction TCP start a one-time counter for each segment sent Once a timer matures, the corresponding segment is considered to be error  Retransmit the segment

65 Figure 12-13 Corrupted Segment The McGraw-Hill Companies, Inc., 2000

66 Figure 12-14 Lost Segment The McGraw-Hill Companies, Inc., 2000

67 Duplicate Segment  Created by a source TCP when the acknowledgment does not arrive before the time-out  Destination detects duplicate segment since they have the same sequence number Discard the later segment

68 Out-of-Order Segment  Each TCP segment is encapsulated in an IP datagram IP datagram is routed independently TCP segment may arrive out-of-order  Solution TCP does not acknowledge an out-of-order segment until it receives all of the segments that precede it

69 Lost Acknowledgment  A lost acknowledgment may not even noticed by the source TCP Since TCP uses an accumulative acknowledgment system

70 Figure 12-15 Lost Acknowledgment The McGraw-Hill Companies, Inc., 2000

71 TCP TIMERS 12.7 The McGraw-Hill Companies, Inc., 2000

72 Figure 12-16 TCP Timers The McGraw-Hill Companies, Inc., 2000

73 Retransmission Timer  When TCP sends a segment, it creates a retransmission timer to that segment If an acknowledgment is received before the timer goes off  The timer is destroyed If timer goes off before an acknowledgment arrives  The segment is retransmitted and the timer is reset

74 Calculation of Retransmission Time  TCP cannot use the same retransmission time for all connections Each connection has different length and network characteristics  Furthermore, TCP cannot use the same retransmission time for one single connection The network behavior is dynamic  Thus, TCP uses the dynamic retransmission time Different for each connection and may be changed during the same connection

75 Calculation of Retransmission Time (Cont.)  Retransmission time is calculated as twice the RTT Retransmission time = 2 x RTT  But, how to calculate RTT?

76 Calculation of RTT  Two methods Use the timestamp option described before TCP start a timer when sends a segment. After receiving the acknowledgment, calculate the difference  RTT = a x previous RTT + (1-a) current RTT a is usually 90 percent

77 Calculation of RTT (Cont.)  Problem If a segment is not acknowledged during the retransmission period and it is retransmitted When the sending TCP receives an acknowledgment, it does not know this acknowledgment is for the first one or for the retransmitted one?  Solution Karn ’ s algorithm

78 Karn ’ s Algorithm  Do not consider the RTT of a retransmitted segment is the calculation of the new RTT

79 Persistence Timer  TCP needs another timer to deal with the zero window-size advertisement  Example Receiving TCP announces a window size of zero The sending TCP stops transmitting segments After a while, receiving TCP sends an acknowledgment announcing a non-zero window size  However, this acknowledgment was lost As a result, both sender and receiver continue to wait for each other forever

80 Persistence Timer (Cont.)  Solution: TCP uses a persistence timer for each connection  When the sending TCP receives an acknowledgment with a window size of zero It starts a persistence timer  When the timer goes off The sending TCP sends a special segment called a probe  Contain only 1 byte of data and is never acknowledged  Alert the receiving TCP that the acknowledgment may by lost and should be resent

81 Persistence Timer (Cont.)  Value of persistence timer is set to the value of the retransmission time  However, if a response is not received from the receiver Another probe segment is sent The value of the persistence timer is double  Above process is repeated until the persistence timer reaches a threshold Usually 60 seconds

82 Keepalive Timer  If a client has crashed A TCP connection will be remain open forever  Solution: Keepalive timer The time-out is usually 2 hours If a server does not hear from the client after two hours  Send a probe segment If there is no response after 10 probes, each of which is 75 seconds apart  It assumes that client is down and terminates the connection

83 Time-Waited Timer  Used during connection termination  When TCP closes a connection It does not consider the connection really closed  The connection is held in limbo for a time-waited period Allow duplicate FIN segment, if any, to arrive at the destination to be discarded  Time-waited time is usually two times the expected lifetime of a segment Mentioned later

84 CONGESTION CONTROL 12.8 The McGraw-Hill Companies, Inc., 2000

85 Congestion Control  An internet is a combination of networks and connecting devices, e.g., routers  A router has a buffer that stores the incoming packets, processes them, and forward them.  When the buffer is full, packets will be dropped in the router No acknowledgement is received by the sender The sender will retransmit the lost packet  Create more congestion and more dropping of packets

86 TCP assumes that the cause of a lost segment is due to congestion in the network. The McGraw-Hill Companies, Inc., 2000

87 Congestion Control (Cont.)  Flow control Sender window size is determined by the available buffer space in the receiver  However, in addition to the receiver, the network should be a second entity that determines the size of the sender ’ s window  Congestion control Determine the sender window size by the congestion condition in the network

88 If the cause of the lost segment is congestion, retransmission of the segment not only does not remove the cause, it aggravates it. The McGraw-Hill Companies, Inc., 2000

89 Congestion Control (Cont.)  Thus, the sender ’ s window size is determined by both Receiver Congestion in the network

90 Congestion Window  The sender has two pieces of information The receiver-advertised window size The congestion widow size  The actual size of the window is the minimum of these two Actual window size = minimum (receiver window size, congestion window size)

91 Congestion Avoidance  Two strategies Slow start Additive increase and Multiplicative decrease

92 Slow Start  Slow start At the beginning, the congestion window size = maximum segment size For each segment that is acknowledged  Increase the congestion window size by one maximum segment unit  Until it reaches a threshold of half the allowable window size

93 Slow Start  However, it is not actually “ slow start ” The congestion window size increases exponentially Send one segment, receives one acknowledge Increase the size to two segments, send two segments, receives two acknowledges Increase the size to four segments …

94 Additive Increase and Multiplicative Decrease  Additive Increase After the congestion window size reaches the threshold, the size is increased one segment for each ack. even an ack. is for several segments The additive increase continues as long as  The acknowledgments arrive before their corresponding time-outs  The congestion window size reaches the receiver window value

95 Additive Increase and Multiplicative Decrease (Cont.)  Multiplicative Decrease If congestion occurs, the congestion window size must be decreased How to detect a congestion? Solution: through a lost segment  Networks today are noise free, it is more probable that a segment is lost than that it is corrupted

96 Additive Increase and Multiplicative Decrease (Cont.)  Multiplicative Decrease Thus, if a time-out occurs, i.e., a lost segment occurs  The threshold should be set to half of the last congestion window size Multiplicative decrease  The congestion window size should start from one again The sender return to the slow start phase

97 Example  Initially, the maximum window size is 32 segments Threshold is set to 16 segments, half of the maximum window size  1~4 in x-axis: slow start  5-8 in x-axis: additive increase  8 in x-axis: multiplicative decrease The previous window size = 20 Thus, the new threshold is 10

98 Figure 12-17 Multiplicative Decrease The McGraw-Hill Companies, Inc., 2000

99 Figure 12-18 Congestion Avoidance Strategies The McGraw-Hill Companies, Inc., 2000

100 SEGMENT 12.9 The McGraw-Hill Companies, Inc., 2000

101 Figure 12-19 TCP Segment Format The McGraw-Hill Companies, Inc., 2000

102 TCP Segment Format  Source port address: 16-bit  Destination port address: 16-bit  Sequence number: 32-bit The first byte number in this segment  Acknowledgment number: 32-bit The byte number that the receiver expects Acknowledgment and data can be piggybacked together

103 TCP Segment Format (Cont.)  Header length: 4-bit The number of 4-byte words in the TCP header Value of this field is between 5 and 15  TCP header is between 20-60 bytes  Reserved: 6-bit  Reserved for future use  Control: 6-bits

104 Figure 12-20 Control Field The McGraw-Hill Companies, Inc., 2000

105 TCP Segment Format (Cont.)  Control URG: urgent pointer is valid ACK: acknowledgment field is valid PSH: push the data RST: the connection must be reset SYN: Synchronization sequence numbers during connection FIN: terminate the connection

106 TCP Segment Format (Cont.)  Window size: 16-bit Define the size of the window, in bytes The maximum window size is 2^16 = 65535  Checksum: 16-bit  Urgent pointer: 16-bit Used when the segment contains urgent data  Options: 0~40 bytes

107 OPTIONS 12.10 The McGraw-Hill Companies, Inc., 2000

108 Figure 12-21 Options The McGraw-Hill Companies, Inc., 2000

109 End of Option  Used for padding at the end of the option field Can only be used as the last option  Only one end of option can be used If more than 1 byte is needed to align the option field, use some no-operation option followed by an end of option  Three 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

110 Figure 12-22 End of option Option The McGraw-Hill Companies, Inc., 2000

111 No Operation  Used to align the next option on a 32-bit boundary

112 Figure 12-23 No operation Option The McGraw-Hill Companies, Inc., 2000

113 Maximum Segment Size (MSS)  Define the size of the biggest chunk of data that can be received by the destination  Notably, it actually defines the maximum size of data, not the maximum size of segment  Default value is 536  Determined during the connection establishment phase If neither party defines the size, the default is chosen

114 Figure 12-24 Maximum segment size Option The McGraw-Hill Companies, Inc., 2000

115 Window Scale Factor  The window size field in the header defines the size of the sliding window The size of the windows: 0 ~ 65535 However, it may not be sufficient in some networks  To increase the window size, the window scale factor is used New window size = window size defined in the header x 2 window scale factor  However, the window size cannot be greater than the maximum value for the sequence number

116 Window Scale Factor (Cont.)  Notably, window scale factor can be determined only during the connection setup phase  During data transfer, the size of the window may be changed But it must be multiplied by the same scale factor  The scale factor is also called shift count Multiplying a number by power of 2 = left shift

117 Figure 12-25 Window scale factor Option The McGraw-Hill Companies, Inc., 2000

118 Timestamp  Timestamp field Filled by the source when a segment leaves  When destination sends an acknowledgement Enter the previous stored timestamp into the timestamp echo reply field  The source, when it receives acknowledgment Calculate the round-trip time  Round-trip time Used by TCP to dynamically define the retransmission time

119 Figure 12-26 Timestamp Option The McGraw-Hill Companies, Inc., 2000

120 CHECKSUM 12.11 The McGraw-Hill Companies, Inc., 2000

121 Checksum  Follow the same procedure as in UDP  However, The inclusion of the checksum in the UDP datagram is optional The inclusion of checksum for TCP is mandatory

122 Figure 12-12 Pseudoheader Added to the TCP Datagram The McGraw-Hill Companies, Inc., 2000

123 CONNECTION 12.12 The McGraw-Hill Companies, Inc., 2000

124 Connection  TCP ’ s connection-oriented transmission requires two procedures Connection establishment  Three-way handshaking Connection termination  Four-way handshaking

125 Connection Establishment  Four actions are taken between host A and B Host A sends a segment to announce its wish for connection and includes its initialization information Host B sends a segment to acknowledge the request of A Host B sends a segment that includes its initialization information Host A sends a segment to acknowledge the request of B  However Step 2 and 3 can not combined into one step

126 Connection Establishment (Cont.)  Three-way handshaking The client sends the first segment, a SYN segment  Source and destination port number  Initialization sequence number (ISN)  If client wants to define MSS, add MSS option  If client needs a larger window, define the window scale factor option  Does not contain any acknowledgment number  Does not define the window size either A window size makes sense only when a segment includes an acknowledgment

127 Connection Establishment (Cont.)  Three-way handshaking The server sends a second segment, a SYN and ACK segment  Acknowledge the receipt of the first segment using the ACK flag and acknowledgment number field The acknowledgment number is the client initialization sequence number + 1 The server must also defines the client window size  Initialization information for the server Initialization sequence number Window scale factor if used MSS is defined

128 Figure 12-28 Three-way Handshaking The McGraw-Hill Companies, Inc., 2000

129 Connection Establishment (Cont.)  Three-way handshaking The client sends the third segment, ACK segment  Acknowledge the receipt of second segment ACK flag is set Acknowledgement number = server initialization sequence number + 1 Must also define the server window size  Set the window size field  Data can be sent with the third packet

130 Connection Establishment (Cont.)  Active open The side that sends the first SYN  Passive open The side that receives this SYN and sends the next SYN

131 Connection Termination  The connection may be closed in one connection, but left open in the other connection When connection in one direction is terminated  The other party can continue sending data in the other direction  Therefore, four actions are needed to close the connection in both direction Step 2 and 3 cannot be combined

132 Connection Termination  Four steps Host A sends a segment announcing its wish for connection termination Host B sends a segment acknowledging the request of A  The connection is closed in one connection  But host A can continue sending data to A Host B sends a segment to close the connection Host A acknowledges the request of B

133 Connection Termination (Cont.)  Four-way handshaking The client TCP sends the first segment, FIN segment The server TCP sends the second segment, an ACK segment  Acknowledgment number = sequence number in FIN + 1 The server TCP may continue to send data until it sends a FIN segment The client TCP sends the fourth segment, an ACK segment  Acknowledgment number = sequence number in FIN + 1

134 Connection Resetting  Reset: the current connection is destroyed  Three cases needs to be reset The TCP on one side has requested a connection to a nonexistent port  TCP on the other side may send a segment with its RST bit set to cancel the request One TCP may want to abort the connection due to an abnormal situation  It can send an RST segment to close the connection The TCP on one side may discover that the TCP on the other side is idle for a long time  It may send an RST segment to destroy the connection

135 Figure 12-29 Four-way Handshaking The McGraw-Hill Companies, Inc., 2000

136 STATE TRANSITION DIAGRAM 12.13 The McGraw-Hill Companies, Inc., 2000

137 Figure 12-30 State Transition Diagram The McGraw-Hill Companies, Inc., 2000

138 Figure 12-31 Client States The McGraw-Hill Companies, Inc., 2000

139 Figure 12-32 Server States The McGraw-Hill Companies, Inc., 2000

140 TCP OPERATION 12.14 The McGraw-Hill Companies, Inc., 2000

141 TCP Operations  Encapsulation and Decapsulation  Buffering  Multiplexing and Demultiplexing  Pushing Data  Urgent Data

142 Encapsulation and Decapsulation

143 Buffering  TCP creates sending and receiving buffers for each connection Discussed before

144 Multiplexing and Demultiplexing

145 Pushing Data  In some applications, delayed transmission and delayed delivery of data may not be acceptable  TCP provides the push operation Sending TCP should not wait for the window to be filled  It must create a segment, set the push bit (PSH), and send it immediately

146 Urgent Data  In some cases, the sending application wants a piece of data to be read out of order  TCP provides the urgent data Sender creates a segment, insert the urgent data at the beginning of the segment and sends the segment with the URG bit set The urgent pointer field defines the end of the urgent data and the start of normal data

147 TCP PACKAGE 12.15 The McGraw-Hill Companies, Inc., 2000

148 TCP Package

149 TCBs: Transmission Control Block


Download ppt "Chapter 12 Transmission Control Protocol (TCP). Outline  PROCESS-TO-PROCESS COMMUNICATION  TCP SERVICES  NUMBERING BYTES  FLOW CONTROL  SILLY WINDOW."

Similar presentations


Ads by Google