Patch: DatagramSocket/MulticastSocket constructor fix

Warren Levy warrenl@cygnus.com
Sun Mar 5 00:58:00 GMT 2000


Folks,
I'm committing the following patch that takes care of a problem with 
using the MulticastSocket or DatagramSocket constructors that don't take 
an address (or if you pass a null address).  These used to work but were 
affected by another change a few months back.  Enjoy!
--warrenl


2000-03-05  Warren Levy  <warrenl@cygnus.com>

        * java/net/DatagramSocket.java(DatagramSocket(int,InetAddress):
          Handle null addresses.



Index: java/net/DatagramSocket.java
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/net/DatagramSocket.java,v
retrieving revision 1.6
diff -u -p -r1.6 DatagramSocket.java
--- DatagramSocket.java 2000/01/19 18:39:26     1.6
+++ DatagramSocket.java 2000/03/05 08:57:09
@@ -1,6 +1,6 @@
 // DatagramSocket.java
 
-/* Copyright (C) 1999  Red Hat, Inc.
+/* Copyright (C) 1999, 2000  Red Hat, Inc.
 
    This file is part of libgcj.
 
@@ -66,7 +66,7 @@ public class DatagramSocket
     if (this instanceof MulticastSocket)
       impl.setOption(SocketOptions.SO_REUSEADDR, new Boolean(true));
 
-    impl.bind(port, laddr);
+    impl.bind(port, laddr == null ? ServerSocket.ANY_IF : laddr);
   }
 
   public void close()



More information about the Java-patches mailing list