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
operation.
[SUS]

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.
.



Relevant Pages

  • Re: Socket Creation
    ... drivers until it reaches the TCP/IP driver. ... When a packet is received at a NIC the NIC hardware does some trivial ... specifications of a previously-created socket, ... may be an incomplete datagram - just a "fragment". ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Socket Buffers
    ... Also note that, even if a packet has been received, the ioctlsocket can give ... an indication of '0' for the length when the socket is a datagram socket ... > Paul T. ...
    (microsoft.public.windowsce.app.development)
  • Re: udp multithreading
    ... I have to monitor many systems in the same moment, ... // Crea un datagram Packet ... It looks like you are trying to create a new socket for each remote host, or even each packet sent - I'm not sure which. ...
    (comp.lang.java.programmer)
  • Re: Can recvfrom() return more than 1 packet?
    ... There is only a "whole IP packet" if the whole datagram fits in one ... getting back to the original post, what you get when you call recvfrom() ... SOCK_DGRAM socket causes you to receive datagrams. ...
    (comp.unix.programmer)
  • Re: Problem with detecting the reception of a datagram
    ... packet monitor you are blind and have no idea what's actually going on. ... but the listen module is not at all ... executing if there is no datagram sent from a remote host.. ...
    (comp.unix.programmer)