Commit 948888e1 by Michael Koch Committed by Michael Koch

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.

From-SVN: r73949
parent 7fb1d711
2003-11-26 Michael Koch <konqueror@gmx.de> 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.
2003-11-26 Michael Koch <konqueror@gmx.de>
* java/net/URL.java * java/net/URL.java
(URL): Fixed documentation to be HTML compliant. (URL): Fixed documentation to be HTML compliant.
(getContent): Completed documentation. (getContent): Completed documentation.
......
...@@ -73,6 +73,11 @@ public class ServerSocket ...@@ -73,6 +73,11 @@ public class ServerSocket
*/ */
private SocketImpl impl; private SocketImpl impl;
/**
* True if socket is bound.
*/
private boolean bound;
/* /*
* This constructor is only used by java.nio. * This constructor is only used by java.nio.
*/ */
...@@ -225,6 +230,7 @@ public class ServerSocket ...@@ -225,6 +230,7 @@ public class ServerSocket
{ {
impl.bind (tmp.getAddress (), tmp.getPort ()); impl.bind (tmp.getAddress (), tmp.getPort ());
impl.listen(backlog); impl.listen(backlog);
bound = true;
} }
catch (IOException exception) catch (IOException exception)
{ {
...@@ -355,6 +361,7 @@ public class ServerSocket ...@@ -355,6 +361,7 @@ public class ServerSocket
getChannel().close(); getChannel().close();
impl = null; impl = null;
bound = false;
} }
} }
...@@ -379,16 +386,7 @@ public class ServerSocket ...@@ -379,16 +386,7 @@ public class ServerSocket
*/ */
public boolean isBound() public boolean isBound()
{ {
try return bound;
{
Object bindaddr = impl.getOption (SocketOptions.SO_BINDADDR);
}
catch (SocketException e)
{
return false;
}
return true;
} }
/** /**
......
...@@ -79,10 +79,25 @@ public class Socket ...@@ -79,10 +79,25 @@ public class Socket
*/ */
private SocketImpl impl; 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 * Initializes a new instance of <code>Socket</code> object without
...@@ -342,6 +357,7 @@ public class Socket ...@@ -342,6 +357,7 @@ public class Socket
try try
{ {
getImpl().bind (tmp.getAddress(), tmp.getPort()); getImpl().bind (tmp.getAddress(), tmp.getPort());
bound = true;
} }
catch (IOException exception) catch (IOException exception)
{ {
...@@ -995,6 +1011,7 @@ public class Socket ...@@ -995,6 +1011,7 @@ public class Socket
getChannel().close(); getChannel().close();
impl = null; impl = null;
bound = false;
} }
/** /**
...@@ -1206,7 +1223,7 @@ public class Socket ...@@ -1206,7 +1223,7 @@ public class Socket
*/ */
public boolean isBound () public boolean isBound ()
{ {
return getLocalAddress () != null; return bound;
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment