This is the mail archive of the java-patches@sourceware.cygnus.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch: DatagramSocket/MulticastSocket constructor fix


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()


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]