Package net.i2p.i2ptunnel.socks
Class SocketWrapper
java.lang.Object
net.i2p.i2ptunnel.socks.SocketWrapper
- All Implemented Interfaces:
Closeable,AutoCloseable,I2PSocket
Wrapper around the Socket obtained from the Outproxy, which is a
wrapper around the Orchid Stream.
- Since:
- 0.9.27
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.i2p.client.streaming.I2PSocket
I2PSocket.SocketErrorListener -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Deprecated.As of 0.9.9 will throw an IOE if socket is closed.intThe local port.As of 0.9.9 will throw an IOE if socket is closed.intgetPort()The remote port.longHow long we will wait blocked on a read() operation.booleanisClosed()voidreset()Just calls close()voidsetOptions(I2PSocketOptions options) Does nothingvoidsetReadTimeout(long ms) Define how long we will wait blocked on a read() operation (-1 will make the socket wait forever).voidDeprecated, unimplemented, does nothing
-
Constructor Details
-
SocketWrapper
-
-
Method Details
-
getThisDestination
- Specified by:
getThisDestinationin interfaceI2PSocket- Returns:
- the Destination of this side of the socket.
-
getPeerDestination
- Specified by:
getPeerDestinationin interfaceI2PSocket- Returns:
- the destination of the peer.
-
getInputStream
Description copied from interface:I2PSocketAs of 0.9.9 will throw an IOE if socket is closed. Prior to that would return null instead of throwing IOE.Note that operations on the returned stream may return an
IOExceptionwhose cause as returned byThrowable.getCause()is anI2PSocketException. If so, the client may retrieve a status code viaI2PSocketException.getStatus()to provide specific feedback to the user.- Specified by:
getInputStreamin interfaceI2PSocket- Returns:
- an InputStream to read from the socket. Non-null since 0.9.9.
- Throws:
IOException- on failure
-
getOutputStream
Description copied from interface:I2PSocketAs of 0.9.9 will throw an IOE if socket is closed. Prior to that would return null instead of throwing IOE.Note that operations on the returned stream may return an
IOExceptionwhose cause as returned byThrowable.getCause()is anI2PSocketException. If so, the client may retrieve a status code viaI2PSocketException.getStatus()to provide specific feedback to the user.- Specified by:
getOutputStreamin interfaceI2PSocket- Returns:
- an OutputStream to write into the socket. Non-null since 0.9.9.
- Throws:
IOException- on failure
-
getChannel
Deprecated.Description copied from interface:I2PSocketUnimplemented, unlikely to ever be implemented.- Specified by:
getChannelin interfaceI2PSocket- Returns:
- null always
-
getOptions
- Specified by:
getOptionsin interfaceI2PSocket- Returns:
- null always
-
setOptions
Does nothing- Specified by:
setOptionsin interfaceI2PSocket- Parameters:
options- I2PSocketOptions to set
-
getReadTimeout
public long getReadTimeout()Description copied from interface:I2PSocketHow long we will wait blocked on a read() operation. This is simply a helper to query the I2PSocketOptions- Specified by:
getReadTimeoutin interfaceI2PSocket- Returns:
- milliseconds to wait, or -1 if we will wait indefinitely
-
setReadTimeout
public void setReadTimeout(long ms) Description copied from interface:I2PSocketDefine how long we will wait blocked on a read() operation (-1 will make the socket wait forever). This is simply a helper to adjust the I2PSocketOptions- Specified by:
setReadTimeoutin interfaceI2PSocket- Parameters:
ms- timeout in ms
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
reset
Just calls close()- Specified by:
resetin interfaceI2PSocket- Throws:
IOException- Since:
- 0.9.30
-
isClosed
public boolean isClosed() -
setSocketErrorListener
Deprecated, unimplemented, does nothing- Specified by:
setSocketErrorListenerin interfaceI2PSocket
-
getPort
public int getPort()The remote port. -
getLocalPort
public int getLocalPort()The local port.- Specified by:
getLocalPortin interfaceI2PSocket- Returns:
- 0 always
-