public interface I2PSocketManager| Modifier and Type | Interface and Description |
|---|---|
static interface | I2PSocketManager.DisconnectListenerListener for notification when an I2P session is disconnected |
| Modifier and Type | Method and Description |
|---|---|
void | addDisconnectListener(I2PSocketManager.DisconnectListener lsnr)lsnr). |
I2PSession | addSubsession(InputStream privateKeyStream,
Properties opts)For a server, you must call connect() on the returned object. |
I2PSocketOptions | buildOptions()Create a copy of the current options, to be used in a setDefaultOptions() call. |
I2PSocketOptions | buildOptions(Properties opts)Create a modified copy of the current options, to be used in a setDefaultOptions() call. |
I2PSocket | connect(Destination peer)Create a new connected socket (block until the socket is created) |
I2PSocket | connect(Destination peer,
I2PSocketOptions options)Create a new connected socket (block until the socket is created) |
Socket | connectToSocket(Destination peer)Like connect() but returns a real Socket, and throws only IOE,
for easier porting of apps. |
Socket | connectToSocket(Destination peer,
int timeout)Like connect() but returns a real Socket, and throws only IOE,
for easier porting of apps. |
void | destroySocketManager()Destroy the socket manager, freeing all the associated resources. |
long | getAcceptTimeout()getAcceptTimeout(). |
I2PSocketOptions | getDefaultOptions()Current options, not a copy, setters may be used to make changes. |
String | getName()For logging / diagnostics only |
I2PServerSocket | getServerSocket()Returns non-null socket. |
I2PSession | getSession()Get the I2P session. |
ServerSocket | getStandardServerSocket()Like getServerSocket but returns a real ServerSocket for easier porting of apps. |
List<I2PSession> | getSubsessions()Get all subsessions. |
void | init(I2PAppContext context,
I2PSession session,
Properties opts,
String name)Deprecated - Factory will initialize. |
boolean | isDestroyed()Has the socket manager been destroyed? |
Set<I2PSocket> | listSockets()Retrieve a set of currently connected I2PSockets, either initiated locally or remotely. |
boolean | ping(Destination peer,
int localPort,
int remotePort,
long timeoutMs)Ping the specified peer, returning true if they replied to the ping within
the timeout specified, false otherwise. |
byte[] | ping(Destination peer,
int localPort,
int remotePort,
long timeoutMs,
byte[] payload)Ping the specified peer, returning true if they replied to the ping within
the timeout specified, false otherwise. |
boolean | ping(Destination peer,
long timeoutMs)Ping the specified peer, returning true if they replied to the ping within
the timeout specified, false otherwise. |
void | removeDisconnectListener(I2PSocketManager.DisconnectListener lsnr)lsnr). |
void | removeSubsession(I2PSession session)Remove a subsession. |
void | setAcceptTimeout(long ms)How long should we wait for the client to .accept() a socket before
sending back a NACK/Close? |
void | setDefaultOptions(I2PSocketOptions options)Update the options on a running socket manager. |
void | setName(String name)For logging / diagnostics only |
void addDisconnectListener(I2PSocketManager.DisconnectListener lsnr)
I2PSession addSubsession(InputStream privateKeyStream, Properties opts) throws I2PSessionException
privateKeyStream - null for transient, if non-null must have same encryption keys as primary session
and different signing keysopts - subsession options if any, may be nullI2PSessionExceptionI2PSocketOptions buildOptions()
I2PSocketOptions buildOptions(Properties opts)
opts - The new options, may be nullI2PSocket connect(Destination peer) throws I2PException, ConnectException, NoRouteToHostException, InterruptedIOException
peer - Destination to connect toConnectException - if the peer refuses the connectionNoRouteToHostException - if the peer is not found or not reachableInterruptedIOException - if the connection timeoutsI2PException - if there is some other I2P-related problemI2PSocket connect(Destination peer, I2PSocketOptions options) throws I2PException, ConnectException, NoRouteToHostException, InterruptedIOException
peer - Destination to connect tooptions - I2P socket options to be used for connectingConnectException - if the peer refuses the connectionNoRouteToHostException - if the peer is not found or not reachableInterruptedIOException - if the connection timeoutsI2PException - if there is some other I2P-related problemSocket connectToSocket(Destination peer) throws IOException
peer - the destinationIOException - on I/O errorSocket connectToSocket(Destination peer, int timeout) throws IOException
peer - the destinationtimeout - ms if > 0, forces blocking (disables connectDelay)IOException - on I/O errorvoid destroySocketManager()
long getAcceptTimeout()
I2PSocketOptions getDefaultOptions()
String getName()
I2PServerSocket getServerSocket()
I2PSession getSession()
ServerSocket getStandardServerSocket() throws IOException
IOException - on I/O errorList<I2PSession> getSubsessions()
void init(I2PAppContext context, I2PSession session, Properties opts, String name)
context - the I2P app contextsession - the sessionopts - the optionsname - the nameUnsupportedOperationException - alwaysboolean isDestroyed()
Set<I2PSocket> listSockets()
boolean ping(Destination peer, int localPort, int remotePort, long timeoutMs)
peer - Destination to pinglocalPort - 0 - 65535remotePort - 0 - 65535timeoutMs - timeout in ms, greater than zeroIllegalArgumentException - on bad argsbyte[] ping(Destination peer, int localPort, int remotePort, long timeoutMs, byte[] payload)
peer - Destination to pinglocalPort - 0 - 65535remotePort - 0 - 65535timeoutMs - timeout in ms, greater than zeropayload - to include in the pingIllegalArgumentException - on bad argsboolean ping(Destination peer, long timeoutMs)
peer - Destination to pingtimeoutMs - timeout in ms, greater than zeroIllegalArgumentException - on bad argsvoid removeDisconnectListener(I2PSocketManager.DisconnectListener lsnr)
void removeSubsession(I2PSession session)
session - the subsession to removevoid setAcceptTimeout(long ms)
ms - milliseconds to wait, maximumvoid setDefaultOptions(I2PSocketOptions options)
options - as created from a call to buildOptions(properties), non-nullvoid setName(String name)
name - the name