Re: recvfrom with MSG_PEEK

Alan Cox (alan@lxorguk.ukuu.org.uk)
Tue, 20 May 1997 23:35:36 +0100 (BST)


> recvfrom(sock, (char *)NULL, 0, MSG_PEEK, (struct sockaddr *)&sin, &size)
> should return the address from which the data was sent in sin. This does
> not happen on Linux but on *BSD. Where as calling with "(char *)buf, 1"

You didnt receive any data, you read none so it didnt come from anywhere. I'd
argue Linux did exactly the right thing. For a connected socket then yes I
guess it could return where the data must have come from, but that isnt clear
for some protocol types.

And posix 1003.1g doesnt provide any useful clues.