Hi all,

attached is a small patch from Guilhem hat fixes the behaviour of DatagramSocket.bind(null) to match the API spec in 1.4.2, i.e. pick an ephemeral port and a local address to bind to.


2003-11-21 Guilhem Lavaux <[EMAIL PROTECTED]>


        * libraries/javalib/java/net/DatagramSocket.java:
        (bind) When address is null, it should bind to an available
        port.
--- /var/tmp/PROJECTS/classpath//./java/net/DatagramSocket.java Mon Sep 22 16:56:08 
2003
+++ /tmp/topic/kaffe/libraries/javalib/java/net/DatagramSocket.java     Mon Nov  3 
18:24:43 2003
@@ -573,7 +579,8 @@
   /**
    * Binds the socket to the given socket address.
    *
-   * @param address The socket address to bind to.
+   * @param address The socket address to bind to. If address is null, bind
+   * will take an ephemeral port and a valid local address to bind the socket.
    *
    * @exception SocketException If an error occurs.
    * @exception SecurityException If a security manager exists and
@@ -585,6 +592,9 @@
   public void bind (SocketAddress address)
     throws SocketException
   {
+    if (address == null)
+      address = new InetSocketAddress (InetAddress.ANY_IF, 0);
+    
     if (! (address instanceof InetSocketAddress))
       throw new IllegalArgumentException ();
 
_______________________________________________
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath

Reply via email to