TCP/IP packets and datagrams

user1927452 picture user1927452 · Dec 25, 2012 · Viewed 13.1k times · Source

Is it true that upon receiving a segment from Transport Layer(TCP) towards Network Layer(IP) the resulting data unit will be a packet. Whereas when receiving a user datagram from Transport Layer(UDP) the resulting data unit will be a datagram?

Answer

D.Shawley picture D.Shawley · Dec 25, 2012

You are getting caught up in the details ... packet and datagram are not exactly well defined terms. I also think that you are also looking at things backwards. In a conventional network:

  1. the link layer (e.g., 802.3 "Ethernet" or 802.11 "Wi-Fi") presents frames to the network layer (e.g., IP, ICMP)
  2. The network layer assembles the frames into packets which are passed on to the next layer in the stack - the transport layer
  3. The transport layer, in turn, passes the bytes on to the application layer. The application layer API is really what distinguishes between data streams in TCP and datagrams in UDP

The OSI stack isn't really used in practice any longer. In most cases, it has been replaced by the Internet Protocol Suite. The easiest way to understand how network stacks work is to buy a copy of "TCP/IP Illustrated: Volume 1", download a nice network capture utility, and watch some Internet traffic. You can see how the packets are assembled from the physical layer upward.