transferred, in this case part of zyx. At this point the packet consists only of the data, the socket number and
the number of bytes of data, and will be handed over to TCP.
TCP will then add to the frame the TCP source and destination port numbers, packet sequence numbers
(when a long message is being sent in small pieces, each piece gets a sequence number to identify it), and
so on, and then pass the packet to IP.
IP will add to the packet a code indicating the fact that this is a TCP packet (as opposed to UDP, another type
of communication service offered in the TCP/IP protocol), plus the source and destination IP addresses, and
so on, and pass the packet to the NIC.
In for example the Ethernet case, the NIC will then add to the packet the source and destination Ethernet
addresses, a code indicating that this message uses the TCP/IP protocol suite.
The packets sent at the physical level have a special name, frames.
When a frame reaches the destination machine, a mirror image of the above process occurs. The packet will
now travel up the protocol stack, and will shrink as it does so. In the ftp example, the "top" of the stack will
be ftpd, which is the "partner" program of ftp running on the destination machine.
Note also that as the packet gets routed through intermediate machines on its way to the destination, at each
of these intermediate machines it will travel up the protocol stack to the Network Layer (i.e. IP), which will
check to see whether it has reached the destination, and then upon finding that it hasn't, it will be sent back
down the stack for transmission to the next machine in its path to the destination.
4 More on TCP/IP
TCP/IP is a very complex system, the subject of numerous thick books, and we cannot go into detail on it in
this document. We will give only a short introduction.
4.1 TCP/IP Overview
A famous and very common network protocol is TCP/IP. It was originally invented as part of the UNIX OS,
and later became the basis for the Internet (the Internet was developed mainly on UNIX machines). For the
latter reason, it is now part of other OSs, such as Windows.
10We are "writing" to the socket, as if we were writing to a file, but the effect is to send the data through the network. This is a
nice feature in UNIX, as it gives us a uniform interface to both files and sockets. In Windows systems, this is not available and thus
use, for example, the sendto() function instead; this function is also available in UNIX.
8
TCP/IP actually includes two protocols at the transport level, TCP and UDP, and one at the network level,
IP.
4.1.1 TCP
TCP is a connection-oriented protocol. As mentioned earlier, the term connection does not refer to a
physical connection, but rather to a temporary agreement set up between the source and destination nodes
concerning the processing of a sequence of ordered packets, such as the sizes of the pieces of a file sent
Overview of Computer Networks
Start from the beginning
