aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/net/ServerSocket.java
diff options
context:
space:
mode:
authorMichael Koch <konqueror@gmx.de>2002-09-21 06:59:20 +0000
committerMichael Koch <mkoch@gcc.gnu.org>2002-09-21 06:59:20 +0000
commitbe362a0d5ba42bee36bd339e25374100a9f1942c (patch)
tree83851aefa46dabb8d83a414a2859a534a89184ca /libjava/java/net/ServerSocket.java
parent84d7dd4a5361d64c2168b354b2c7c03b4f21a8f5 (diff)
downloadgcc-be362a0d5ba42bee36bd339e25374100a9f1942c.zip
gcc-be362a0d5ba42bee36bd339e25374100a9f1942c.tar.gz
gcc-be362a0d5ba42bee36bd339e25374100a9f1942c.tar.bz2
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. From-SVN: r57380
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 c6b1870..b706acc 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