

		Problems with the SENDTO call in Linux
		--------------------------------------

Usually UDP packets are sent to a receiver without any confirmation from
the receiver to the sender. However, if the packet cannot be delivered,
an ICMP 'port_unreachable' packet is returned. BSD style sockets
conveniently ignore this packet. However, in Linux the following is the
default: when an ICMP packet 'port_unreachable' is received, the next
invocation of sendto() will return an error (ECONNREFUSED), although
this error is actually unrelated to the sendto() call (it is in fact
related to a previous sendto() invocation). To turn this unwanted
behavior off, socket option SO_BSDCOMPAT would have to be turned
on. However, in the current version of the JDK setting this option is
not permitted. Therefore, for Linux the following workaround is used:
after a sendto() has been invoked on the datagram socket, it will be
closed and recreated immediately. The effect of this in terms of
performance and resource consumption is undefined. Performance is
certainly slower. Opening a huge number of sockets and closing them
again should actually not use up too many resources, but this has to be
tested. The idea is, of course, to remove the workaround, as soon as the
JDK allows setting option SO_BSDCOMPAT, or the JDK port to Linux uses
this option by default.

