diff options
author | mkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-11-26 12:45:21 +0000 |
---|---|---|
committer | mkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-11-26 12:45:21 +0000 |
commit | 22a46e2e88de732360d1b7bb7ef88caa517e18a5 (patch) | |
tree | ff79d9b5ed0094b0b236d0b15c5fe6b883f980e6 /libjava/java/net | |
parent | 12cfe0cae3182330ad669f1f653b646853f6b136 (diff) | |
download | gcc-22a46e2e88de732360d1b7bb7ef88caa517e18a5.tar.gz |
2003-11-26 Michael Koch <konqueror@gmx.de>
* java/net/Socket.java
(implCreated): Dont set default value explicitely, added
documentation.
(inputShutdown): Likewise.
(outputShutdown): Likewise.
(bound): New private member variable.
(bind): Set bound to true.
(close): Set bound to false.
(isBound): Return bound.
* java/net/ServerSocket.java
(bound): New private member variable.
(bind): Set bound to true.
(close): Set bound to false.
(isBound): Return bound.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@73949 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/net')
-rw-r--r-- | libjava/java/net/ServerSocket.java | 18 | ||||
-rw-r--r-- | libjava/java/net/Socket.java | 25 |
2 files changed, 29 insertions, 14 deletions
diff --git a/libjava/java/net/ServerSocket.java b/libjava/java/net/ServerSocket.java index d1ea4d6c2ba..7af1a3301c0 100644 --- a/libjava/java/net/ServerSocket.java +++ b/libjava/java/net/ServerSocket.java @@ -73,6 +73,11 @@ public class ServerSocket */ private SocketImpl impl; + /** + * True if socket is bound. + */ + private boolean bound; + /* * This constructor is only used by java.nio. */ @@ -225,6 +230,7 @@ public class ServerSocket { impl.bind (tmp.getAddress (), tmp.getPort ()); impl.listen(backlog); + bound = true; } catch (IOException exception) { @@ -355,6 +361,7 @@ public class ServerSocket getChannel().close(); impl = null; + bound = false; } } @@ -379,16 +386,7 @@ public class ServerSocket */ public boolean isBound() { - try - { - Object bindaddr = impl.getOption (SocketOptions.SO_BINDADDR); - } - catch (SocketException e) - { - return false; - } - - return true; + return bound; } /** diff --git a/libjava/java/net/Socket.java b/libjava/java/net/Socket.java index 1b443d08a1e..27fa69131b5 100644 --- a/libjava/java/net/Socket.java +++ b/libjava/java/net/Socket.java @@ -79,10 +79,25 @@ public class Socket */ private SocketImpl impl; - private boolean implCreated = false; + /** + * True if socket implementation was created by calling their create() method. + */ + private boolean implCreated; + + /** + * True if the socket is bound. + */ + private boolean bound; - private boolean inputShutdown = false; - private boolean outputShutdown = false; + /** + * True if input is shutdown. + */ + private boolean inputShutdown; + + /** + * True if output is shutdown. + */ + private boolean outputShutdown; /** * Initializes a new instance of <code>Socket</code> object without @@ -342,6 +357,7 @@ public class Socket try { getImpl().bind (tmp.getAddress(), tmp.getPort()); + bound = true; } catch (IOException exception) { @@ -995,6 +1011,7 @@ public class Socket getChannel().close(); impl = null; + bound = false; } /** @@ -1206,7 +1223,7 @@ public class Socket */ public boolean isBound () { - return getLocalAddress () != null; + return bound; } /** |