Computer Networks (CS425) : Transport Layer Protocol-Implementation Issues
Computer Networks (CS425) : Transport Layer Protocol-Implementation Issues
State Diagram
The state diagram approach to view the TCP connection establishment and closing simplifies the design of
TCP implementation. The idea is to represent the TCP connection state, which progresses from one state to
other as various messages are exchanged. To simplify the matter, we considered two state diagrams, viz.,
for TCP connection establishment and TCP connection closing.
Fig 1 shows the state diagram for the TCP connection establishment and associated table briefly explains
each state.
1/5
11/8/2014
Listen
Syn-Sent
From this state, the server can close the service or actively open a connection
by sending SYN.
Represents waiting for a matching for a connection request after having sent a
connection request. This applies to both server and client side. Even though
server is considered as the one with passive open, it can also send a SYN
packet actively.
Syn_Rcvd
Estab
Represents an open connection. Data transfer can take place from this point
onwards.
After the connection has been established, two end-points will exchange useful information and terminate
the connection. Fig. 2 shows the state diagram for terminating an active connection.
FIN-WAIT-1
http://www.cse.iitk.ac.in/users/dheeraj/cs425/lec16.html
2/5
11/8/2014
FIN-WAIT-2
CLOSING
TIME_WAIT
This represents waiting time enough for the packets to reach their destination.
This waiting time is usually 4 min.
CLOSE_WAIT
Represents a state when the server receives a FIN from the remote TCP , sends
ACK and issues close call sending FIN
LAST_ACK
Represents waiting for an ACK for the previously sent FIN-ACK to the
remote TCP
CLOSE
3/5
11/8/2014
and some time later, the server should be free to process the new request. Hence if we drop the packet, the
client will go through the time-out and retransmission and server will be free to process it.
Also, Standard TCP does not define any strategy/option of knowing who requested the connection. Only
Solaris 2.2 supports this option.
Delayed Acknowledgment
TCP will piggyback the acknowledgment with its data. But if the peer does not have the any data to send at
that moment, the acknowledgment should not be delayed too long. Hence a timer for 200 ms will be used.
At every 200 ms, TCP will check for any acknowledgment to be sent and send them as individual packets.
Small packets
TCP implementation discourages small packets. Especially if a previous relatively large packet has been
sent and no acknowledgment has been received so far, then this small packet will be stored in the buffer
until the situation improves.
But there are some applications for which delayed data is worse than bad data. For example, in telnet, each
key stroke will be processed by the server and hence no delay should be introduced. As we have seen in
Unix Networking programming, options for the socket can be set as NO_DELAY, so that small packets are
not discouraged.
ICMP Source Quench
We have seen in ICMP that ICMP Source Quench message will be send for the peer to slow down. Some
implementations discard this message, but few set the current window size to 1.
But this is not a very good idea.
Retransmission Timeout
In some implementation (E.g.. Linux), RTO = RTT + 4 * delay variance is used to instead of constant 2.
Also instead of calculating RTT(est) from the scratch, cache will be used to store the history from which
new values are calculated as discussed in the previous classes.
Standard values for Maximum Segment Life (MSL) will be between 0.5 to 2 minutes and Time wait state
= f(MSL)
Keep Alive Time
Another important timer in TCP is keep alive timer. It is basically used by a TCP peer to check whether
the other end is up or down. It periodically checks this connection. If the other end did not respond, then
that connection will be closed.
Persist Timer
As we saw in TCP window management, when source sends one full window of packets, it will set its
window size to 0 and expects an ACK from remote TCP to increase its window size. Suppose such an
ACK has been sent and is lost. Hence source will have current window size = 0 and cannot send &
http://www.cse.iitk.ac.in/users/dheeraj/cs425/lec16.html
4/5
11/8/2014
destination is expecting next byte. To avoid such a deadlock, a Persist Timer will be used. When this timer
goes off, the source will send the last one byte again. So we hope that situation has improved and an ACK
to increase the current window size will be received.
References
http://www.ssfnet.org/Exchange/tcp/tcpTutorialNotes.html
back to top
Prev| Next | Index
http://www.cse.iitk.ac.in/users/dheeraj/cs425/lec16.html
5/5