public interface I2PSocket extends Closeable
I2PSocketManager.connect(Destination).Note that this is not a standard Java Socket,
if you need one of those, use I2PSocketManager.connectToSocket(Destination) instead.
| Modifier and Type | Interface and Description |
|---|---|
static interface | I2PSocket.SocketErrorListenerDeprecated, unimplemented, does nothing. |
| Modifier and Type | Method and Description |
|---|---|
InputStream | getInputStream()As of 0.9.9 will throw an IOE if socket is closed. |
default long | getLifetimeBytesReceived()How many bytes have been received over the lifetime of this socket. |
default long | getLifetimeBytesSent()How many bytes have been sent over the lifetime of this socket. |
int | getLocalPort()The local port. |
I2PSocketOptions | getOptions()Returns the socket's configuration. |
OutputStream | getOutputStream()As of 0.9.9 will throw an IOE if socket is closed. |
Destination | getPeerDestination()Returns the destination of the peer. |
int | getPort()The remote port. |
long | getReadTimeout()How long we will wait blocked on a read() operation. |
Destination | getThisDestination()Returns the Destination of this side of the socket. |
boolean | isClosed()Returns whether this socket has been closed. |
void | reset()Resets and closes this socket. |
void | setOptions(I2PSocketOptions options)Configure the socket |
void | setReadTimeout(long ms)Define how long we will wait blocked on a read() operation (-1 will make
the socket wait forever). |
void | setSocketErrorListener(I2PSocket.SocketErrorListener lsnr)Deprecated, unimplemented, does nothing. |
InputStream getInputStream() throws IOException
Note that operations on the returned stream may return an
IOException whose cause as returned by
Throwable.getCause() is an I2PSocketException.
If so, the client may retrieve a status code via
I2PSocketException.getStatus() to provide specific feedback to the user.
IOException - on failuredefault long getLifetimeBytesReceived()
default long getLifetimeBytesSent()
int getLocalPort()
I2PSocketOptions getOptions()
OutputStream getOutputStream() throws IOException
Note that operations on the returned stream may return an
IOException whose cause as returned by
Throwable.getCause() is an I2PSocketException.
If so, the client may retrieve a status code via
I2PSocketException.getStatus() to provide specific feedback to the user.
IOException - on failureDestination getPeerDestination()
int getPort()
long getReadTimeout()
Destination getThisDestination()
boolean isClosed()
void reset()
throws IOExceptionIOException - on reset failurevoid setOptions(I2PSocketOptions options)
options - I2PSocketOptions to setvoid setReadTimeout(long ms)
ms - timeout in msvoid setSocketErrorListener(I2PSocket.SocketErrorListener lsnr)
lsnr - the listener (ignored)