summaryrefslogtreecommitdiffstats
path: root/libjava/java/net/ServerSocket.java
diff options
context:
space:
mode:
authormkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4>2002-09-21 06:59:20 +0000
committermkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4>2002-09-21 06:59:20 +0000
commit0bec35175e233138cf86e1c8661d92274e1a09df (patch)
tree83851aefa46dabb8d83a414a2859a534a89184ca /libjava/java/net/ServerSocket.java
parent35196dd446ec678e6c918f6540c1cd7b6530b821 (diff)
downloadppe42-gcc-0bec35175e233138cf86e1c8661d92274e1a09df.tar.gz
ppe42-gcc-0bec35175e233138cf86e1c8661d92274e1a09df.zip
2002-09-21 Michael Koch <konqueror@gmx.de>
* java/net/Socket.java (sendUrgentData): New method. (getChannel): New method. * java/net/ServerSocket.java (getChannel): New method. (isBound): New method. * java/net/DatagramSocket.java (DatagramSocket): Two new methods. (bind): New method. (getChannel): New method. (isBound): New method. (send): Added newline to to make shorter lines. * java/net/PlainDatagramSocketImpl.java (mcastGrp): Added argument. (join): Use new mcastGrp. (leave): Use new mcastGrp. (joinGroup): New method. (leaveGroup): New method. * java/net/natPlainDatagramSocketImpl.cc (mcastGrp): Added argument, no yet really implemented. (getOption): Added newline for shorter lines. * java/net/natPlainSocketImpl.cc (read, setOption, getOption): Added newline for shorter lines. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@57380 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/net/ServerSocket.java')
-rw-r--r--libjava/java/net/ServerSocket.java40
1 files changed, 40 insertions, 0 deletions
diff --git a/libjava/java/net/ServerSocket.java b/libjava/java/net/ServerSocket.java
index c6b187071ec..b706acca58c 100644
--- a/libjava/java/net/ServerSocket.java
+++ b/libjava/java/net/ServerSocket.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package java.net;
import java.io.IOException;
+import java.nio.channels.ServerSocketChannel;
/* Written using on-line Java Platform 1.2 API Specification.
* Status: I believe all methods are implemented.
@@ -75,6 +76,12 @@ public class ServerSocket
private SocketImpl impl;
/**
+ * ServerSocketChannel of this ServerSocket. This channel only exists
+ * when the socket is created by ServerSocketChannel.open().
+ */
+ private ServerSocketChannel ch;
+
+ /**
* Private constructor that simply sets the implementation.
*/
private ServerSocket()
@@ -282,6 +289,39 @@ public class ServerSocket
}
/**
+ * Returns the unique ServerSocketChannel object
+ * associated with this socket, if any.
+ *
+ * The socket only has a ServerSocketChannel if its created
+ * by ServerSocketChannel.open.
+ *
+ * @since 1.4
+ */
+ public ServerSocketChannel getChannel()
+ {
+ return ch;
+ }
+
+ /**
+ * Returns true then the socket is bound, otherwise false
+ *
+ * @since 1.4
+ */
+ public boolean isBound()
+ {
+ try
+ {
+ Object bindaddr = impl.getOption (SocketOptions.SO_BINDADDR);
+ }
+ catch (SocketException e)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
* Sets the value of SO_TIMEOUT. A value of 0 implies that SO_TIMEOUT is
* disabled (ie, operations never time out). This is the number of
* milliseconds a socket operation can block before an
OpenPOWER on IntegriCloud