diff options
author | Tom Tromey <tromey@redhat.com> | 2002-08-30 18:16:00 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2002-08-30 18:16:00 +0000 |
commit | 4c322bff290ba4cf86aefa934a8c26acd3350aae (patch) | |
tree | 6b8d006ff1e5363ff7071fe6e79480680b240d33 /libjava/java/net/Socket.java | |
parent | 55f49e3d50d0a2d4158ecb93fbb8d079f396b1d2 (diff) | |
download | gcc-4c322bff290ba4cf86aefa934a8c26acd3350aae.zip gcc-4c322bff290ba4cf86aefa934a8c26acd3350aae.tar.gz gcc-4c322bff290ba4cf86aefa934a8c26acd3350aae.tar.bz2 |
JarURLConnection.java (getCertificates): New method from Classpath.
* java/net/JarURLConnection.java (getCertificates): New method
from Classpath.
* java/net/URLClassLoader.java (URLClassLoader): Extends
SecureClassLoader.
(definePackage): New method from Classpath.
(getPermissions): Likewise.
(newInstance): Likewise.
(findClass): Construct CodeSource for new class (from Classpath).
* java/net/SocketImpl.java (shutdownInput, shutdownOutput): New
methods.
* java/net/URL.java (getUserInfo): New method.
(set(String,String,int,String,String,String,String,String)): New
method.
* java/net/PlainSocketImpl.java (_Jv_SO_KEEPALIVE_): Define.
(shutdownInput, shutdownOutput): Declare.
* java/net/PlainDatagramSocketImpl.java (_Jv_SO_KEEPALIVE_):
Define.
* java/net/natPlainSocketImpl.cc (setOption): Handle keepalive.
(getOption): Likewise.
(shutdownInput): New method.
(shutdownOutput): Likewise.
* java/net/natPlainDatagramSocketImpl.cc (setOption): Handle
keepalive.
(getOption): Likewise.
* java/net/SocketOptions.java (SO_KEEPALIVE): New constant.
* java/net/Socket.java (setKeepAlive): New method.
(getKeepAlive): Likewise.
(shutdownInput, shutdownOutput): New methods.
From-SVN: r56685
Diffstat (limited to 'libjava/java/net/Socket.java')
-rw-r--r-- | libjava/java/net/Socket.java | 63 |
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(); + } } |