Sunday, February 10, 2008

Understanding TCP/IP Protocols

The TCP/IP family of protocols forms the basis of the Internet and most present-day corporate
networks. Computer programs send and receive data over an IP network by making
program calls to the TCP/IP software, known as the protocol stack, in their local computer.
The TCP/IP stack in the local computer exchanges information with the TCP/IP stack in
the target computer to accomplish the transfer of data from one side to the other. The information
they exchange consists the size of the chunks of data they exchange (the datagram
size), the identification associated with each datagram (the datagram header), and what
should occur if a datagram is lost or damaged in transit.
It’s the Internet Protocol (IP) that determines how datagrams get transferred across an IP
network, from the sending program to the receiving program. Datagrams are the units sent
and received from end to end by the two sides, and they move in hops, or segments, across a
network. Each hop has its own network characteristics; for example, some hops may be fast
Ethernet hops, whereas other hops may be slower modem connections. To optimize the
performance of the hops, devices on the network may perform datagram fragmentation,
cutting large datagrams into smaller pieces, called packets, which need to be reassembled
back into the original datagrams once received.
When a datagram arrives at a router or switch in a network, the router or switch decides
where the datagram should go in its next hop, and forwards it along. In later chapters we’ll
come back to this discussion of hops through the network, but for now, suffice it to say that
too much time spent going through one or more of the hops can delay the datagrams and
add variation in the delay time, making the telephone conversation sound poor.
The sending and receiving application programs communicate by means of a couple of
related protocols when they contact their TCP/IP stack.
TCP: When making calls to the Transmission Control Protocol (TCP) interface, the
sending program wants to make sure that the receiving program gets everything that is
sent – that is, it wants to avoid data being lost, duplicated, or out of order. TCP is
known as a connection-oriented protocol because the two sides of the data exchange
maintain strong tracking about everything that’s sent and received. For example, your
browser uses the TCP interface when fetching Web pages – you don’t want to see holes
or out-of-order pieces of data on the screen, so your browser and the Web server program
work together to make sure everything is received intact.
UDP: When using the User Datagram Protocol (UDP), the sending application has no
assurance of delivery, and it’s willing to deal with that. UDP is called a connection-less
protocol, which means that when using this protocol, the two sides don’t acknowledge
receiving any data to make sure everything arrived intact. Think about a stock ticker
running across the bottom of your screen. If a datagram is lost, causing one of the
quotes to be lost, it’s not catastrophic because another will come along shortly – a stock
ticker application is a good example of a program that uses the UDP programming
interface to send data.
The application assembles datagrams to contain protocol-specific information. The TCP or
UDP portion of an individual datagram is nested inside the IP portion. For example, there’s
a header that describes how the payload of a UDP datagram is to be decoded. In turn, an IP
header containing information such as the network addresses of the sender and the receiver
encapsulates that header.

No comments: