[kaffe] [PATCH] java.net.DatagramSocket:setBroadcast
Michal Schmidt
xschmi00 at stud.feec.vutbr.cz
Mon May 10 07:41:01 PDT 2004
Hello!
I'm a beginner in Java and I'm new to Kaffe. I tried running JLink
(http://user.it.uu.se/~alse7905/JLink/) under Kaffe. At first it didn't
work because of missing implementation of javax.swing.*. I modified the
JLink source and removed all references to javax.swing. The JLink GUI
wasn't that important for me anyway. Then I hit another problem - Kaffe
doesn't implement method setBroadcast in java.net.DatagramSocket correctly.
I've fixed this and now it works for me. The needed changes are very
small. I'm attaching a patch against kaffe-1.1.4 from Debian unstable.
I've also created a little testing program, which is attached too.
Without the patch it gives this output:
Socket created
First sent
FAILURE!
java.net.SocketException: Unknown socket option
at gnu.java.net.PlainDatagramSocketImpl.setOption
(PlainDatagramSocketImpl.java:71)
at java.net.DatagramSocket.setBroadcast (DatagramSocket.java:837)
at testbroadcast.main (testbroadcast.java:18)
With the patch the output is this:
Socket created
First sent
Broadcast flag set
Second sent
Broadcast flag unset
The next one should fail:
It did fail, OK. Here's the exception:
java.net.SocketException: Permission denied
at gnu.java.net.PlainDatagramSocketImpl.send
(PlainDatagramSocketImpl.java)
at java.net.DatagramSocket.send (DatagramSocket.java:624)
at testbroadcast.SendSomeBroadcast (testbroadcast.java:9)
at testbroadcast.main (testbroadcast.java:26)
That's all, folks!
I'm looking forward to your comments.
Michal Schmidt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testbroadcast.java
Type: text/x-java
Size: 1185 bytes
Desc: not available
Url : http://kaffe.org/pipermail/kaffe/attachments/20040510/ba304320/attachment-0002.java
-------------- next part --------------
A non-text attachment was scrubbed...
Name: setBroadcast.patch
Type: text/x-patch
Size: 1223 bytes
Desc: not available
Url : http://kaffe.org/pipermail/kaffe/attachments/20040510/ba304320/attachment-0002.bin
More information about the kaffe
mailing list