[kaffe] libraries/javalib/java/net/Socket.java

Ito Kazumitsu ito.kazumitsu at mail.hidec.co.jp
Tue Sep 14 23:55:37 PDT 2004


In message "Re: [kaffe] libraries/javalib/java/net/Socket.java"
    on 04/09/15, Ito Kazumitsu <ito.kazumitsu at mail.hidec.co.jp> writes:

> isBound() returns false when it should return true.

This happens to sockets returned by ServerSocket.accept().

A server socket creates a socket using new Socket() when accept()
is called,  but there is no chance that the bound status of the
created socket can be changed.

This is my proposed patch.

--- java/net/ServerSocket.java.orig	Tue May 18 07:25:06 2004
+++ java/net/ServerSocket.java	Wed Sep 15 15:40:24 2004
@@ -376,6 +376,8 @@
 
     impl.accept(socket.impl);
     socket.implCreated = true;
+    socket.bound = true;
+    socket.impl.localport = getLocalPort();
   }
 
   /**
--- java/net/Socket.java.orig	Tue Sep 14 16:04:32 2004
+++ java/net/Socket.java	Wed Sep 15 15:29:55 2004
@@ -91,7 +91,8 @@
   /**
    * True if the socket is bound.
    */
-  private boolean bound;
+  // package-private because ServerSocket.implAccept() needs to access it.
+  boolean bound;
 
   /**
    * True if input is shutdown.




More information about the kaffe mailing list