Package net.i2p.client.streaming.impl
Class I2PSocketFull
java.lang.Object
net.i2p.client.streaming.impl.I2PSocketFull
- All Implemented Interfaces:
Closeable,AutoCloseable,I2PSocket
Bridge between the full streaming lib and the I2PSocket API
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.i2p.client.streaming.I2PSocket
I2PSocket.SocketErrorListener -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes this socket.(package private) voiddestroy()(package private) voiddestroy2()Call from Connection.disconnectComplete() instead of destroy() so we don't loopDeprecated.(package private) ConnectionAs 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()Resets and closes this socket.voidsetOptions(I2PSocketOptions options) Configure the socketvoidsetReadTimeout(long ms) Define how long we will wait blocked on a read() operation (-1 will make the socket wait forever).voidDeprecated, unimplemented, does nothingtoString()
-
Constructor Details
-
I2PSocketFull
-
-
Method Details
-
close
Closes this socket. Nonblocking as of 0.9.9: Any thread currently blocked in an I/O operation upon this socket will throw an IOException. Once a socket has been closed, it is not available for further networking use (i.e. can't be reconnected or rebound). A new socket needs to be created. Closing this socket will also close the socket's InputStream and OutputStream.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
reset
Resets and closes this socket. Sends a RESET indication to the far-end. This is the equivalent of setSoLinger(true, 0) followed by close() on a Java Socket. Nonblocking. Any thread currently blocked in an I/O operation upon this socket will throw an IOException. Once a socket has been reset, it is not available for further networking use (i.e. can't be reconnected or rebound). A new socket needs to be created. Resetting this socket will also close the socket's InputStream and OutputStream.- Specified by:
resetin interfaceI2PSocket- Throws:
IOException- Since:
- 0.9.30
-
getConnection
Connection getConnection() -
getInputStream
As of 0.9.9 will throw an IOE if socket is closed. Prior to that would return null instead of throwing IOE.- Specified by:
getInputStreamin interfaceI2PSocket- Returns:
- non-null
- Throws:
IOException- on failure
-
getOptions
- Specified by:
getOptionsin interfaceI2PSocket- Returns:
- socket's configuration
-
getChannel
Deprecated.Unimplemented, unlikely to ever be implemented.- Specified by:
getChannelin interfaceI2PSocket- Returns:
- null always
- Since:
- 0.8.9
-
getOutputStream
As of 0.9.9 will throw an IOE if socket is closed. Prior to that would return null instead of throwing IOE.- Specified by:
getOutputStreamin interfaceI2PSocket- Returns:
- non-null
- Throws:
IOException- on failure
-
getPeerDestination
- Specified by:
getPeerDestinationin interfaceI2PSocket- Returns:
- the destination of the peer.
-
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
-
getThisDestination
- Specified by:
getThisDestinationin interfaceI2PSocket- Returns:
- the Destination of this side of the socket.
-
setOptions
Description copied from interface:I2PSocketConfigure the socket- Specified by:
setOptionsin interfaceI2PSocket- Parameters:
options- I2PSocketOptions to set
-
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
-
setSocketErrorListener
Deprecated, unimplemented, does nothing- Specified by:
setSocketErrorListenerin interfaceI2PSocket
-
isClosed
public boolean isClosed() -
destroy
void destroy() -
destroy2
void destroy2()Call from Connection.disconnectComplete() instead of destroy() so we don't loop- Since:
- 0.8.13
-
getPort
public int getPort()The remote port. -
getLocalPort
public int getLocalPort()The local port.- Specified by:
getLocalPortin interfaceI2PSocket- Returns:
- the port or 0 if unknown
- Since:
- 0.8.9
-
toString
-