diff options
author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-01-11 01:17:19 +0000 |
---|---|---|
committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-01-11 01:17:19 +0000 |
commit | d96296969502ea794088f26f3e8e92324640ba34 (patch) | |
tree | 52d5c61480de7bafcb2350a66e100dff889e5727 /libjava/java/net/ServerSocket.java | |
parent | c4c9770c5f799e314ed4e8b7873b41769daf59c7 (diff) | |
download | ppe42-gcc-d96296969502ea794088f26f3e8e92324640ba34.tar.gz ppe42-gcc-d96296969502ea794088f26f3e8e92324640ba34.zip |
2003-01-10 Michael Koch <konqueror@gmx.de>
* java/net/DatagramSocket.java
(ch): Description added.
(remotePort): Initialize with -1.
(connect): Doesnt throws SocketException.
* java/net/MulticastSocket.java
(setInterface): Merge with Classpath.
* java/net/ServerSocket.java
(closed): New member variable.
(bind): Check if socket is closed.
(close): Close an associated channel too, set new value to closed.
(isBound): Reindented.
(isClosed): Implemented.
* java/net/Socket.java
(closed): New member variable.
(bind): Check if socket is closed.
(connect): Check if socket is closed.
(close): Close an associated channel too, set new value to closed.
(isClosed): Implemented.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@61185 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/net/ServerSocket.java')
-rw-r--r-- | libjava/java/net/ServerSocket.java | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/libjava/java/net/ServerSocket.java b/libjava/java/net/ServerSocket.java index 62917b6a8a5..e2f8e637d09 100644 --- a/libjava/java/net/ServerSocket.java +++ b/libjava/java/net/ServerSocket.java @@ -77,6 +77,8 @@ public class ServerSocket */ private ServerSocketChannel ch; + private boolean closed = false; + /** * Constructor that simply sets the implementation. * @@ -200,6 +202,9 @@ public class ServerSocket */ public void bind (SocketAddress endpoint, int backlog) throws IOException { + if (closed) + throw new SocketException ("ServerSocket is closed"); + if (impl == null) throw new IOException ("Cannot initialize Socket implementation"); @@ -315,7 +320,13 @@ public class ServerSocket */ public void close () throws IOException { - impl.close(); + if (impl != null) + impl.close (); + + if (ch != null) + ch.close (); + + closed = true; } /** @@ -358,8 +369,7 @@ public class ServerSocket */ public boolean isClosed() { - // FIXME: implement this - return false; + return closed; } /** |