I used recvmsg() in an UDP-based file transfer program. The data packet
format was something like 2 octets "sender slot number" (in network byte
order), 8 octets packet serial number (ditto), and payload. The ACK format
was the same, minus payload.
In the receiver, the first two fields were scattered into an u16 and an
u32[2]. The payload was scattered into a malloc()'d buffer and possibly
linked into a sliding window, based on the packet serial number. The first
two fields were reused for acking.
The sender kept iterating over its own sliding window, sending out data
packets at a predefined rate. The packet number was checked in any ACK
that came in (quickly, with the help of the reflected slot number), and if
it was a match, the ACK'd payload and the packet serial number were
evicted from the slot and the slot was refilled from stdin and the
incremented packet counter.
Or something like that.
I wrote it for SUSv1 and it even ran on OpenVMS. Nothing industrial, just
a hobby project that still comes in handy occasionally. If anyone wanted
to take a look, <
http://freecode.com/projects/udp_copy2>.
... I'm not saying scatter read was "required", but it felt quite fitting
at the time.
Laszlo