natPlainDatagramSocketImpl.cc (bind): Call setsockopt to enable SO_BROADCAST.

2002-02-18  Bryce McKinlay  <bryce@waitaki.otago.ac.nz>

	* java/net/natPlainDatagramSocketImpl.cc (bind): Call setsockopt to
	enable SO_BROADCAST.

From-SVN: r49835
This commit is contained in:
Bryce McKinlay 2002-02-18 07:32:34 +00:00 committed by Bryce McKinlay
parent 6b6294f118
commit 95407a28f6
2 changed files with 10 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2002-02-18 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
* java/net/natPlainDatagramSocketImpl.cc (bind): Call setsockopt to
enable SO_BROADCAST.
2002-02-18 Jason Merrill <jason@redhat.com>
* name-finder.cc (toHex): Use word mode, not long long.

View File

@ -194,7 +194,6 @@ void
java::net::PlainDatagramSocketImpl::bind (jint lport,
java::net::InetAddress *host)
{
// FIXME: prob. need to do a setsockopt with SO_BROADCAST to allow multicast.
union SockAddr u;
struct sockaddr *ptr = (struct sockaddr *) &u.address;
// FIXME: Use getaddrinfo() to get actual protocol instead of assuming ipv4.
@ -233,6 +232,11 @@ java::net::PlainDatagramSocketImpl::bind (jint lport,
localPort = ntohs (u.address.sin_port);
else
goto error;
/* Allow broadcast by default. */
int broadcast = 1;
if (::setsockopt (fnum, SOL_SOCKET, SO_BROADCAST, (char *) &broadcast,
sizeof (broadcast)) != 0)
goto error;
return;
}
error: