Subject: Faulty man page or faulty code?
To: None <tech-net@netbsd.org>
From: Joel Wilsson <joelw@unix.se>
List: tech-net
Date: 11/10/2002 10:06:08
According to our sendto(2) man page, "sendto() and sendmsg() may be used
at any time." This is not the case, because using sendto on a connected
datagram socket returns EISCON, as noted in the intro(2) man page.

The Single UNIX Specification reads "If the socket is connection-mode,
dest_addr shall be ignored." Solaris 2.6 does not ignore the destination
address when the socket is connected, and returns EISCON. FreeBSD does
the same, while OpenBSD seem to send the packet to the given destination
(afaict from a quick look at the source code - I don't have an OpenBSD
system available to test).

So the question is, should we change the code (and allow sendto to be
used on connected sockets, like OpenBSD), or should we change the man
page to say that sendto may only be used on unconnected sockets and add
EISCON to the ERROR section?

Note that both behaviours are allowed by the Single UNIX Specification:
[EISCONN]
A destination address was specified and the socket is already connected.
This error may or may not be returned for connection mode sockets.

Personally I think we should change the man page and then close PR 7004.