TCP
and UDP Impact on
Control Networks
Although
TCP is more reliable than UDP, UDP can be quite effective if the application
layer can handle error checking and re-transmission, says George Thomas.
Introduction
In
one of the earlier articles we had discussed the impact of the Internet
Protocol (IP) on control networks. IP resides at the network layer of
the OSI communications model and provides the basic unit of data transfer,
which includes addressing, routing, and fragmentation. The transport
layer of this same model resides above the network layer and provides
station- to-station communications and a common interface to the application
layer. This implies reliable communication, which is either accomplished
at the transport layer or at the application layer.
With
control networks, this is usually accomplished at the application layer
since many control networks were designed before the popularity of TCP/IP
took hold. Still, there are some control network protocols, such as
MODBUS/TCP, which do rely upon the guaranteed delivery mechanism of
TCP and there may be more in the future.
Actually,
at the transport layer of the TCP/IP stack there are two transport protocols,
each of which find service in control networks. The User Datagram Protocol
(UDP) and the Transmission Control Protocol (TCP) will both be discussed
in this article.
User
Datagram Protocol
UDP
provides a connectionless and unreliable transport service since neither
it does not issue acknowledgements to the sender upon receipt of data
nor does it inform the sender that data was lost. Data integrity can
suffer by dropped packets, mis-sequenced packets or by the receipt of
duplicate packets. Any of these situations can occur without the knowledge
of the sender. It appears that UDP is no better than the IP protocol
but there is one big difference. UDP introduces the concept of port
numbers, which are used by the application layer that resides above
UDP. Port numbers have significance in terms of actions requested by
the application itself that require a particular response by the receiving
station.
The
UDP header is short and simple. Only eight bytes are required in the
header. Source and destination ports are each 16-bits long and, therefore,
require four bytes. The message length of 16-bits indicates the length
of the header and attached data. A 16-bit checksum is used to check
the validity of the header and data. The UDP header and attached data,
which comes from the application layer, are encapsulated into the IP
data field.
An
IP header, which provides station addressing, precedes the UDP datagram
and the complete IP datagram is encapsulated into the frame of the data
link layer technology used, such as Ethernet, and sent to the desired
station where the complete process is reversed.
Notice
that the only contribution UDP provided was the assignment of port numbers
for use by the application layer. If UDP is to be used, the application
layer must worry about acknowledging message receipt, correctly ordering
received packets into meaningful messages, discarding duplicate packets
and requesting retransmission of faulty packets since UDP does not provide
this service. However, if the application layer was originally designed
to provide this reliability of service there is no reason to have the
transport layer duplicate efforts so UDP makes sense. UDP has low overhead
and executes quickly making it attractive for control networks.
Port
Numbers
UDP
introduces the port number concept. When a station receives an UDP datagram,
it serves up the port number to the application layer, which then allocates
a buffer area for the attached data. The port number has significance
since it identifies a particular application. Since there are many port
number possibilities, several different applications can be simultaneously
supported on the same station.
Port numbers are 16-bits long and are classified as being assigned,
registered or dynamic. Assigned port numbers in the range of zero to
1023 have been defined by the Internet Assigned Numbers Authority (IANA)
for various applications that are considered part of the TCP/IP protocol
suite. These applications include ...