reffec.com

/ THE TRANSPORT LAYER: TCP in Software Generation Code 3 of 9 in Software / THE TRANSPORT LAYER: TCP

9.4 / THE TRANSPORT LAYER: TCP using software topaint barcode 3 of 9 for asp.net web,windows application Java Platform Rcv ACK Timeout or close LAST_ACK Passive Close: send FIN close Active open send SYN Send SYN Passive open CLOSED Close Rcv SYN send SYNACK LISTEN Rcv RST SYN_SENT Rcv SYNACK send ACK CLOSE_WAIT Rcv FIN Rcv SYN send ACK send SYNACK ESTABLISHED SimultaneRcv RST ous open Rcv Data transfer Close: ACK send FIN Close: send FIN SYN_RCVD Rcv FIN send ACK Simultaneous CLOSING FIN_WAIT_1 close Rcv ACK Rcv FINACK Rcv ACK Active send ACK close FIN_WAIT_2. 2MSL timeout TIME_WAIT Rcv FIN send ACK Figure 9.8 TCP state machine. CLOSED Active open SYN_SENT SYN SYN+ACK ESTABLISHED ACK CLOSED Passive open LISTEN SYN_RCVD Data+ACK Da Software Code 39 Extended ta+ACK Active close FIN_WAIT_1. FIN ESTABLISHED CLOSE_WAIT Passive close LAST_ACK ACK FIN ACK CLOSED Data+ACK Data+ACK FIN_WAIT_2. TIME_WAIT CLOSED Figure 9.9 TCP state timeline. orderly clo Code 39 Extended for None se, simultaneous open, simultaneous close, abortive close. You start (and end) in the CLOSED state. Note that this state diagram is applied for each TCP connection, i.

e., for each socket pair. There is one state in the active close that is worth spending some time on.

This is the TIME WAIT state, also called the 2MSL state. Each implementation must choose a value for the maximum segment lifetime (MSL). This is the longest time a segment can.

CHAPTER 9 / THE TRANSPORT LAYER live in the Software 39 barcode network before being discarded. This time is bounded, as the TTL eld in the IP header ensures segments will die at some point. RFC 793 speci es an MSL of 2 minutes.

You will nd values of 30 seconds, 1 minute and 2 minutes being used in implementations. When TCP does an active close, it must stay in the TIME WAIT state for twice the MSL. This is in case the nal ACK was lost and gives the other end chance to time out and retransmit its nal FIN.

Any other segments that are received in this state are simply dropped. This means that the connection (i.e.

, the quad above) cannot be reused until 2MSL has elapsed. This is not a problem if the client does an active close, as it is likely using an ephemeral port, and any other port will do if we need to make a new connection within the 2MSL. On the other hand, if the server does the active close there is likely a problem.

Since servers often listen on speci c well-known ports, a server cannot restart until the 2MSL has passed. There is a slight problem if a machine in the 2MSL state crashes, reboots, and starts a new connection with the same quad all within 2MSL. There is a chance that delayed segments from the old connection will be interpreted as part of the new connection.

To remedy this, RFC 793 states that TCP should not create any new connections until MSL after rebooting: this is called the quiet time. Not many people implement this, as it usually takes more time than this to reboot, though many get close and high-availability machines can be back up very quickly. Another state of interest is FIN WAIT 2, where we have sent a FIN and the other end has ACKed it, but not yet sent its FIN.

If the remote machine crashes we can be stuck here waiting for ever. Many implementations set a timer on this state and if nothing is forthcoming for a decent period they violate the protocol and move to TIME WAIT. Timeouts from 60 seconds to 10 minutes are common, with smaller values being preferred on heavily loaded servers.

. RFC 793 RFC 793 TCP options RFC 793 RFC 1323 An option s tarts with a 1 byte kind that speci es what this option is to do (see Figure 9.10). Options of kinds 0 and 1 occupy 1 byte.

All other options next have a length eld that gives the total length of this option. This is so that an implementation can skip an option if it does not know the kind. The No Operation (NOP) option is to pad elds out to a multiple of 4 bytes so that they are nicely aligned.

Maximum segment size (MSS) speci es how large a segment we can have without fragmentation. The bigger, the better, of course, as this reduces the overheads of headers. MSS occupies 2 bytes and so has a maximum value of 65535.

This value is strongly affected by the interface MTU. For an Ethernet, whose physical layer allows 1500 bytes, the MSS can be as large as 1460 bytes when we take the 20 byte IP header and 20 byte.
Copyright © reffec.com . All rights reserved.