From owner-freebsd-java Fri Jan 30 11:36:14 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id LAA02250 for java-outgoing; Fri, 30 Jan 1998 11:36:14 -0800 (PST) (envelope-from owner-freebsd-java@FreeBSD.ORG) Received: from whistle.com (s205m131.whistle.com [207.76.205.131]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id LAA02245 for ; Fri, 30 Jan 1998 11:36:13 -0800 (PST) (envelope-from archie@whistle.com) Received: (from smap@localhost) by whistle.com (8.7.5/8.6.12) id LAA02594; Fri, 30 Jan 1998 11:35:05 -0800 (PST) Received: from bubba.whistle.com(207.76.205.7) by whistle.com via smap (V1.3) id sma002587; Fri Jan 30 11:34:37 1998 Received: (from archie@localhost) by bubba.whistle.com (8.8.7/8.6.12) id LAA15454; Fri, 30 Jan 1998 11:34:36 -0800 (PST) From: Archie Cobbs Message-Id: <199801301934.LAA15454@bubba.whistle.com> Subject: bug in MulticastSocket.setInterface() To: freebsd-java@FreeBSD.ORG Date: Fri, 30 Jan 1998 11:34:36 -0800 (PST) Cc: java-port@mt.sri.com X-Mailer: ELM [version 2.4ME+ PL31 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-java@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org X-To-Unsubscribe: mail to majordomo@FreeBSD.org "unsubscribe java" 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); } }