Re: Can recvfrom() return more than 1 packet?

"David Schwartz" <davids@xxxxxxxxxxxxx> writes:
Robert Harris wrote:
OK. The official term for a "whole" IP packet is a datagram.

There is only a "whole IP packet" if the whole datagram fits in one
packet. Do not add new meanings to common terms, it only leads to
confusion. The archives are filled with people who got themselves into
trouble this way.

Packets are the units that are sent and routed over the network. "A
packet is the unit of data that is routed between an origin and a
destination on the Internet or any other packet-switched network."

What is routed on the internet are IP datagrams, which, in the process
of being routed, may be split into smaller IP datagrams by
intermediate routers as needed (IPv4). 'Packet is a more general term
that comes from a class of networks IP-based internets (interconnected
networks) belong to.

But, getting back to the original post, what you get when you call
recvfrom() on a SOCK_DGRAM socket is the (possibly reassambled)
datagram, not a fragment thereof.

Correct. It is important to understand what 'recv' or 'recvfrom' on a
SOCK_DGRAM socket causes you to receive datagrams.

recvfrom - receive a message from a socket


The recvfrom() function shall receive a message from a
connection-mode or connectionless-mode socket.


For message-based sockets, such as SOCK_RAW, SOCK_DGRAM, and
SOCK_SEQPACKET, the entire message shall be read in a single

If your, for instance, happen to be using the 'user datagram
protocol' (UDP) a 'message' (as referenced above) will be put into a
'user datagram', as defined in RFC768, which is technically again
something entirely different.