262 Practical TCP/IP and Ethernet Networking
Note that datagrams (as the IP packets are known) may have to be broken down (or
fragmented) into smaller packets as they pass through a router onto a network with a
smaller frame size (e.g. from Ethernet with a maximum size of 1500 bytes to Arcnet with
a maximum of approximately 800 bytes).
The IP protocol does not guarantee delivery of any of the packets. It merely handles the
routing of the packets to its destination across the different interconnected networks.
Packets could be lost due to routers becoming congested (and thus discarding packets) or
due to corruption of the packets on a network due to electrical noise, for example. Hence
the TCP protocol is used to guarantee delivery of the packets.
18.5.2 Transmission control protocol (or TCP)
Structure of TCP
The TCP protocol is used to guarantee delivery of the packet. Each byte of information is
given a unique sequence number. The receiver keeps track of these sequence numbers
and sends an acknowledgement to indicate to the originator of the packets that it has
received the datagram up to a particular defined byte number.
The TCP protocol initiates the transfer of information using a three-way handshake in
which it exchanges parameters with the node it is transferring this data to.
TCP flow control is based on the concept of a window. The window is used to
determine how much data can be outstanding (i.e. unacknowledged) from the recipient of
the information transfer. The amount of data that can be in transit is referred to as the
bandwidth-delay product. The maximum window size is 64 kbytes (but practically it is
often limited to 32 kbytes).
Sliding windows
Obviously there is a need to get some sort of acknowledgment back to ensure that there is
a guaranteed delivery service. This technique, called positive acknowledgment with
retransmission, requires the receiver to send back an acknowledgment message. Inherent
in this is the concept of a timeout where a timer is started by the transmitter so that if no
response is received from the destination node; another copy of the message will be
transmitted. An example of this situation is given in the figure below.
Figure 18.5
Positive acknowledgment philosophy
Satellites and TCP/IP 263
The sliding window form of positive acknowledgment is used with most efficient
protocols, as it is very time consuming waiting for each individual acknowledgment to be
returned for each packet transmitted. Hence the idea is that a number of packets (the
window) is transmitted before the source may receive an acknowledgment to the first
message (due to time delays, etc). As long as acknowledgments are received, the window
slides along and the next packet is transmitted.
TCP uses a variable size-sliding window. Each acknowledgment from the receiver
contains a window advertisement indicating how many additional bytes of data the
destination will accept. The transmitting node then adjusts the size of its sliding window
appropriately (either up or down). This can be considered to be a form of flow control. It
is very useful for situations where one node is transmitting more data than the receiver
can handle.
Maximum segment size
Both the transmitting and receiving nodes need to agree on the maximum size segments
they will transfer. This is specified in the options field. There is an improvement in
overall efficiency if the maximum segment size is selected that fills the physical packets
that are transmitted across the network. The current specification recommends a
maximum segment size of 536 (default size of IP datagram minus IP and TCP headers).
If the size is not correctly specified; for example too small, the framing bytes consume
most of the packet size resulting in considerable overhead; or too large, the packets have
to be fragmented with a higher probability of loss of a packet and the resultant
retransmission of the entire packet.
Acknowledgments
TCP/IP segments traveling through the Internet can be lost or arrive out of their sequence
order. Each acknowledgment specifies a sequence number which is one greater than the
highest byte received. Essentially acknowledgments always specify the sequence number
of the next byte that the receiver expects to receive. Note further that the receiver always
acknowledges the lowest contiguous prefix of the stream that has been correctly received.
Time out and retransmission
The TCP protocol starts a timer every time it transmits a segment. If no appropriate
acknowledgment is received, TCP arranges to retransmit this segment. One of the
problems with Internet is the rather variable time in receiving a response to a
segment transmitted.
There are various algorithms to calculate the time out time.
A complication arises in calculating the round trip time for retransmitted segments. For
example, if the transmitter times out waiting for an acknowledgment and then decides to
send another packet and an acknowledgment arises shortly after the second packet is
transmitted, the question arises as to which packet the acknowledgment refers to. This can
affect the calculation of the round trip time dramatically. Karn’s algorithm, for example,
can address this problem.
Congestion
There are two techniques used to reduce congestion on a network:
• Multiplicative decrease
This approach is to reduce the size of the window for bytes to transmit by
half on loss of a segment and for these segments still in the window, back off
the retransmission time exponentially. This reduces the traffic dramatically
and allows the gateways to eliminate the congestion.
264 Practical TCP/IP and Ethernet Networking
• Slow start recovery
When ramping up again in transmission rates, a technique called slow start
(additive) recovery is used. This requires the traffic to be increased
gradually by using a window of the size of a single segment and then
increasing the window by one segment each time an acknowledgment
arrives. This is a linear increase as opposed to original exponential increase
when the transfer originally started.
The range of increase of the window is reduced once the window reaches one half of its
original size. TCP, at this point, increases the window by one only if all segments in the
window have been acknowledged.
Establishing/closing/resetting of a TCP connection
A three-way handshake (as indicated in the figure below) is used to establish
a connection.
Figure 18.6
Three-way handshake
The SYN bit is set to one in the code field. As this is a full-duplex-based protocol it is
possible for a connection to be established from both nodes at the same time.
There are two functions that the three-way handshake accomplishes:
• Both sides are ready to commence transfer of data
• A commencing sequence number is agreed upon
An initial sequence number must be chosen by each node (at random) to identify the
bytes in the data stream it is transmitting. It should be realized that the acknowledgments
indicate the number of the next byte expected.
When an application program has finished with transmission of its data, it advises the
TCP software that it has no more data to transmit. The routine indicated in the figure
below is then executed.
When an abnormal condition arises that forces an application program to terminate a
connection, the reset bit is used (RST bit in the CODE). The destination responds
immediately by aborting the connection.
Another protocol, which can be used to transfer data, is referred to as the user
datagram protocol (UDP). This does not guarantee transfer of information but has
considerably lower overhead than the TCP protocol.
Satellites and TCP/IP 265
User datagram protocol (UDP)
It should be noted, of course, that the UDP protocol still provides an unreliable
connectionless delivery service as for the Internet protocol. Hence the application
program must take account of the need for reliability, possibility of message loss, out of
order delivery, etc.
The user datagram protocol (UDP) is the mechanism by which application programs
send datagrams to other application programs. UDP has multiple protocol ports to
identify the different programs executing on a particular node. As discussed in an earlier
chapter, an abstract destination’s source point on a computer is called a protocol port.
There are two types of ports – destination ports on the remote computer node, which
receives the message and source ports on the local computer node.
The UDP uses the underlying Internet protocol to transport a message from one node to
the other. The UDP provides the facility of being able to distinguish among multiple
destinations on a given host computer.
18.6 Weaknesses of TCP/IP in satellite usage
There are a number of weaknesses with the TCP/IP protocol (which are exacerbated with
the use of high latency satellite links). These are listed below:
18.6.1 Window size too small
Figure 18.7
Maximum throughput for a single TCP connection as a function of window size and round trip time (RTT)
(courtesy of Loyola University, see References at the end of this chapter)
In order to use the bandwidth of a satellite channel more effectively, TCP needs to have
a larger window size. If a satellite channel has a round trip delay of say 600 msecs and the
bandwidth is 1.54 Mbps, the bandwidth-delay product would be 0.924 Mbits which
equates to 113 kbytes – this is considerably larger than the 64 kbyte maximum window
size for TCP/IP.
18.6.2 Bandwidth adaptation
Due to the significant latency in the satellite links, TCP adapts rather slowly to bandwidth
changes in the channel. TCP adjusts the window size upwards when the channel becomes
congested and downward when the bandwidth increases. This means that TCP does not
utilize the full bandwidth immediately but has a significant inertia in adapting.
266 Practical TCP/IP and Ethernet Networking
18.6.3 Selective acknowledgment
When a segment is lost, TCP senders will retransmit all the data from the missing
segment regardless of whether subsequent segments from the missing one were received
correctly or not. This loss of a segment is considered evidence of congestion and the
window size is also reduced to half. A more selective mechanism is required. There is a
big difference between loss of segments due to real errors on the communications channel
and congestion. TCP cannot distinguish between the two forms of missing segments.
18.6.4 Slow start
When a TCP transaction is commenced, an initial window size of one segment (normally
about 512 octets) is selected. It then doubles the window size as successful
acknowledgements are received from the destination up and until it reaches the network
saturation state (where a packet is dropped). Hence again, this is a very slow way of
ramping up to full bandwidth utilization. The total time for a TCP slow start period is
calculated as:
Slow start time = RTT * log (B/MSS)
Where
RTT = Round trip time
B = Bandwidth
MSS = TCP segment size
18.6.5 TCP for transactions
A TCP/IP transaction involves the use of the client–server interaction. The client sends a
request to the server and the server then responds with the appropriate information (i.e. it
provides a service to the client). In using the HTTP (hypertext transfer protocol), which
is what the World Wide Web is based on, every item has to be commenced with the
standard three-way handshake as outlined earlier and then the data transferred. This is
particularly inefficient for small data transactions, as the process has to be repeated every
time.
18.7 Methods of optimizing TCP/IP over satellite channels
There are various ways to optimize the use of TCP/IP over a satellite especially the need
to mitigate the effects of latency. Interestingly enough, if these concerns with satellites
can be addressed this will assist in the design and operation of future high-speed
terrestrial networks because of the similar bandwidth * delay characteristic. The major
problems for both satellites and high-speed networks with TCP/IP have been the need for
a larger window size, the slow start period and ineffective bandwidth adaptation effects.
The various issues are discussed below:
Large window extension (TCP-LW)
A modification to the existing TCP/IP protocol allows a large window increasing the
existing one from 2
16
to 2
32
bytes in size. This will allow more effective use of the
communications channel with large bandwidth-delay products. Note that both the receiver
and sender have to use a version of TCP that implements TCP-LW
Selective acknowledgment (TCP-SACK)
A newly defined standard entitled selective acknowledgment allows for the receiving
node to advise the sender immediately of the loss of a packet. The sender will then