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.

From-SVN: r61185
This commit is contained in:
Michael Koch 2003-01-11 01:17:19 +00:00 committed by Tom Tromey
parent b1771c6ac2
commit 927818a598
5 changed files with 70 additions and 13 deletions

View file

@ -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;
}
/**