diff options
author | bryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-02-18 07:32:34 +0000 |
---|---|---|
committer | bryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-02-18 07:32:34 +0000 |
commit | e538908e36b8e22675516b1976acd6cfe1d2745e (patch) | |
tree | 1b2ee1c90fedc89ed2d0e51c6483d7e27780adb8 /libjava | |
parent | 4103fd219393d6067297f568c11b86ffcab74ea6 (diff) | |
download | gcc-e538908e36b8e22675516b1976acd6cfe1d2745e.tar.gz |
2002-02-18 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
* java/net/natPlainDatagramSocketImpl.cc (bind): Call setsockopt to
enable SO_BROADCAST.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@49835 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/ChangeLog | 5 | ||||
-rw-r--r-- | libjava/java/net/natPlainDatagramSocketImpl.cc | 6 |
2 files changed, 10 insertions, 1 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index cf37be1e690..a0770ba1ce9 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -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. diff --git a/libjava/java/net/natPlainDatagramSocketImpl.cc b/libjava/java/net/natPlainDatagramSocketImpl.cc index d94a2f3d8a1..aedd48bbbdd 100644 --- a/libjava/java/net/natPlainDatagramSocketImpl.cc +++ b/libjava/java/net/natPlainDatagramSocketImpl.cc @@ -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: |