aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/net/Socket.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/java/net/Socket.java')
-rw-r--r--libjava/java/net/Socket.java63
1 files changed, 63 insertions, 0 deletions
diff --git a/libjava/java/net/Socket.java b/libjava/java/net/Socket.java
index 6c0df54..217e695 100644
--- a/libjava/java/net/Socket.java
+++ b/libjava/java/net/Socket.java
@@ -618,6 +618,47 @@ public class Socket
}
/**
+ * This method sets the value for the socket level socket option
+ * SO_KEEPALIVE.
+ *
+ * @param on True if SO_KEEPALIVE should be enabled
+ *
+ * @exception SocketException If an error occurs or Socket is not connected
+ *
+ * @since Java 1.3
+ */
+ public void setKeepAlive (boolean on) throws SocketException
+ {
+ if (impl == null)
+ throw new SocketException("Not connected");
+
+ impl.setOption(SocketOptions.SO_RCVBUF, new Boolean(on));
+ }
+
+ /**
+ * This method returns the value of the socket level socket option
+ * SO_KEEPALIVE.
+ *
+ * @return The setting
+ *
+ * @exception SocketException If an error occurs or Socket is not connected
+ *
+ * @since Java 1.3
+ */
+ public boolean getKeepAlive () throws SocketException
+ {
+ if (impl == null)
+ throw new SocketException("Not connected");
+
+ Object buf = impl.getOption(SocketOptions.SO_RCVBUF);
+
+ if (buf instanceof Boolean)
+ return(((Boolean)buf).booleanValue());
+ else
+ throw new SocketException("Internal Error: Unexpected type");
+ }
+
+ /**
* Closes the socket.
*
* @exception IOException If an error occurs
@@ -667,4 +708,26 @@ public class Socket
factory = fac;
}
+
+ /**
+ * Closes the input side of the socket stream.
+ *
+ * @exception IOException If an error occurs.
+ */
+ public void shutdownInput() throws IOException
+ {
+ if (impl != null)
+ impl.shutdownInput();
+ }
+
+ /**
+ * Closes the output side of the socket stream.
+ *
+ * @exception IOException If an error occurs.
+ */
+ public void shutdownOutput() throws IOException
+ {
+ if (impl != null)
+ impl.shutdownOutput();
+ }
}