UDP over v6: payload truncated at 1024 bytes

Luke Gorrie luke@REDACTED
Thu Apr 8 11:35:18 CEST 2004

Matthias Lang <matthias@REDACTED> writes:

> I suspect that re-assembling IP datagrams is required by POSIX,
> i.e. the behaviour will be the same for Solaris, BSD and modern
> variants of Windows. But I haven't checked that. Nor do I have my copy
> of Stevens handy.

I can't quite chapter and verse either, but you're definitely
right. Only the first UDP fragment would contain things like port
number and checksum, and you couldn't test the checksum without
reassembling. Certainly defragmentation of UDP packets does happen
down at IP before it gets close to the user.

I think the problem Peter alluded to is if you're naughty and try to
send datagrams over TCP, i.e. expect read() to return exactly one
thing that was write()'d on the other side, which doesn't work (except
sometimes by accident) since TCP sockets supposed to be continuous
streams. The issue here is TCP segment'ification rather than IP

On the "bugging me for a few days" note.. why doesn't Erlang always
use a 64K buffer for reading UDP? Since the emulator runs in a polling
loop it should only need one such buffer in total: just make a
non-blocking read() into it, create a binary, and it's free again "all
in one go". Or?


More information about the erlang-questions mailing list