Date: Fri, 30 Jan 1998 11:34:36 -0800 (PST) From: Archie Cobbs <archie@whistle.com> To: freebsd-java@FreeBSD.ORG Cc: java-port@mt.sri.com Subject: bug in MulticastSocket.setInterface() Message-ID: <199801301934.LAA15454@bubba.whistle.com>
next in thread | raw e-mail | index | archive | help
When I run the program below, I get this exception: $ java test.McastTest address is foo.bar.com/192.168.1.10 creating socket setting iface java.net.SocketException: invalid DatagramSocket option at java.net.PlainDatagramSocketImpl.setOption(PlainDatagramSocketImpl.java:155) at java.net.MulticastSocket.setInterface(MulticastSocket.java:179) at test.McastTest.main(McastTest.java:22) There seems to be some bug in the setInterface() method. Has any one else seen this, or better yet fixed it? This is using ftp://hub.freebsd.org/pub/incoming/java/jdk1.1.5.tar.gz (downloaded last night) on 2.2.5. Thanks, -Archie P.S. CC'ing this to java-port@mt.sri.com, though I don't subscribe... freebsd-java replies please trim CC list if/when appropriate. ___________________________________________________________________________ Archie Cobbs * Whistle Communications, Inc. * http://www.whistle.com package test; import java.lang.*; import java.io.*; import java.net.*; public class McastTest { public static void main(String[] args) throws Exception { InetAddress addr = InetAddress.getLocalHost(); System.err.println("address is " + addr); // join a Multicast group and send the group salutations byte[] msg = {'H', 'e', 'l', 'l', 'o'}; InetAddress group = InetAddress.getByName("228.5.6.7"); System.err.println("creating socket"); MulticastSocket s = new MulticastSocket(6789); System.err.println("setting iface"); // this line causes problems; comment it out and get no crash s.setInterface(addr); System.err.println("joining group"); s.joinGroup(group); DatagramPacket hi = new DatagramPacket(msg, msg.length, group, 6789); System.err.println("sending packet"); s.send(hi); // get their responses! byte[] buf = new byte[1000]; DatagramPacket recv = new DatagramPacket(buf, buf.length); System.err.println("receiving packet"); s.receive(recv); // OK, I'm done talking - leave the group... System.err.println("leaving group"); s.leaveGroup(group); } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199801301934.LAA15454>