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

@ -85,6 +85,8 @@ public class Socket
SocketChannel ch; // this field must have been set if created by SocketChannel
private boolean closed = false;
// Constructors
/**
@ -308,6 +310,9 @@ public class Socket
*/
public void bind (SocketAddress bindpoint) throws IOException
{
if (closed)
throw new SocketException ("Socket is closed");
if ( !(bindpoint instanceof InetSocketAddress))
throw new IllegalArgumentException ();
@ -330,6 +335,9 @@ public class Socket
public void connect (SocketAddress endpoint)
throws IOException
{
if (closed)
throw new SocketException ("Socket is closed");
if (! (endpoint instanceof InetSocketAddress))
throw new IllegalArgumentException ("Address type not supported");
@ -357,6 +365,9 @@ public class Socket
public void connect (SocketAddress endpoint, int timeout)
throws IOException
{
if (closed)
throw new SocketException ("Socket is closed");
if (! (endpoint instanceof InetSocketAddress))
throw new IllegalArgumentException ("Address type not supported");
@ -853,6 +864,11 @@ public class Socket
{
if (impl != null)
impl.close();
if (ch != null)
ch.close();
closed = true;
}
/**
@ -1035,8 +1051,7 @@ public class Socket
*/
public boolean isClosed ()
{
// FIXME: implement this.
return false;
return closed;
}
/**