I2PSocketManager
public class I2PSocketManagerFull extends java.lang.Object implements I2PSocketManager
I2PSocketManager.DisconnectListener
修飾子とタイプ | フィールド | 説明 |
---|---|---|
(package private) static PcapWriter |
pcapWriter |
|
(package private) static java.lang.String |
PROP_PCAP |
コンストラクタ | 説明 |
---|---|
I2PSocketManagerFull() |
推奨されていません。
use 4-arg constructor
|
I2PSocketManagerFull(I2PAppContext context,
I2PSession session,
java.util.Properties opts,
java.lang.String name) |
This is what I2PSocketManagerFactory.createManager() returns.
|
修飾子とタイプ | メソッド | 説明 |
---|---|---|
void |
addDisconnectListener(I2PSocketManager.DisconnectListener lsnr) |
|
I2PSession |
addSubsession(java.io.InputStream privateKeyStream,
java.util.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(java.util.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.
|
I2PSocket |
connect(Destination peer,
I2PSocketOptions options) |
Create a new connected socket.
|
java.net.Socket |
connectToSocket(Destination peer) |
Like connect() but returns a real Socket, and throws only IOE,
for easier porting of apps.
|
java.net.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() |
|
ConnectionManager |
getConnectionManager() |
|
I2PSocketOptions |
getDefaultOptions() |
Current options, not a copy, setters may be used to make changes.
|
java.lang.String |
getName() |
For logging / diagnostics only
|
I2PServerSocket |
getServerSocket() |
Returns non-null socket.
|
I2PSession |
getSession() |
|
java.net.ServerSocket |
getStandardServerSocket() |
Like getServerSocket but returns a real ServerSocket for easier porting of apps.
|
java.util.List<I2PSession> |
getSubsessions() |
|
void |
init(I2PAppContext context,
I2PSession session,
java.util.Properties opts,
java.lang.String name) |
推奨されていません。
use 4-arg constructor
|
boolean |
isDestroyed() |
Has the socket manager been destroyed?
|
java.util.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.
|
I2PSocket |
receiveSocket() |
The accept() call.
|
void |
removeDisconnectListener(I2PSocketManager.DisconnectListener lsnr) |
|
void |
removeSubsession(I2PSession session) |
Remove the 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(java.lang.String name) |
For logging / diagnostics only
|
static PcapWriter pcapWriter
static final java.lang.String PROP_PCAP
@Deprecated public I2PSocketManagerFull()
java.lang.UnsupportedOperationException
- alwayspublic I2PSocketManagerFull(I2PAppContext context, I2PSession session, java.util.Properties opts, java.lang.String name)
context
- non-nullsession
- non-nullopts
- may be nullname
- non-null@Deprecated public void init(I2PAppContext context, I2PSession session, java.util.Properties opts, java.lang.String name)
I2PSocketManager
init
インタフェース内 I2PSocketManager
java.lang.UnsupportedOperationException
- alwayspublic I2PSocketOptions buildOptions()
buildOptions
インタフェース内 I2PSocketManager
public I2PSocketOptions buildOptions(java.util.Properties opts)
buildOptions
インタフェース内 I2PSocketManager
opts
- The new options, may be nullpublic I2PSession getSession()
getSession
インタフェース内 I2PSocketManager
public I2PSession addSubsession(java.io.InputStream privateKeyStream, java.util.Properties opts) throws I2PSessionException
addSubsession
インタフェース内 I2PSocketManager
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 nullI2PSessionException
public void removeSubsession(I2PSession session)
removeSubsession
インタフェース内 I2PSocketManager
public java.util.List<I2PSession> getSubsessions()
getSubsessions
インタフェース内 I2PSocketManager
public ConnectionManager getConnectionManager()
public I2PSocket receiveSocket() throws I2PException, java.net.ConnectException, java.net.SocketTimeoutException
I2PException
- if session is closedjava.net.ConnectException
- (since 0.9.17; I2PServerSocket interface always declared it)java.net.SocketTimeoutException
- if a timeout was previously set with setSoTimeout and the timeout has been reached.public boolean ping(Destination peer, long timeoutMs)
ping
インタフェース内 I2PSocketManager
peer
- timeoutMs
- timeout in ms, greater than zerojava.lang.IllegalArgumentException
public boolean ping(Destination peer, int localPort, int remotePort, long timeoutMs)
ping
インタフェース内 I2PSocketManager
peer
- Destination to pinglocalPort
- 0 - 65535remotePort
- 0 - 65535timeoutMs
- timeout in ms, greater than zerojava.lang.IllegalArgumentException
public byte[] ping(Destination peer, int localPort, int remotePort, long timeoutMs, byte[] payload)
ping
インタフェース内 I2PSocketManager
peer
- Destination to pinglocalPort
- 0 - 65535remotePort
- 0 - 65535timeoutMs
- timeout in ms, greater than zeropayload
- to include in the pingjava.lang.IllegalArgumentException
public void setAcceptTimeout(long ms)
setAcceptTimeout
インタフェース内 I2PSocketManager
ms
- milliseconds to wait, maximumpublic long getAcceptTimeout()
getAcceptTimeout
インタフェース内 I2PSocketManager
public void setDefaultOptions(I2PSocketOptions options)
setDefaultOptions
インタフェース内 I2PSocketManager
options
- as created from a call to buildOptions(properties), non-nullpublic I2PSocketOptions getDefaultOptions()
getDefaultOptions
インタフェース内 I2PSocketManager
public I2PServerSocket getServerSocket()
getServerSocket
インタフェース内 I2PSocketManager
public java.net.ServerSocket getStandardServerSocket() throws java.io.IOException
getStandardServerSocket
インタフェース内 I2PSocketManager
java.io.IOException
public I2PSocket connect(Destination peer, I2PSocketOptions options) throws I2PException, java.net.NoRouteToHostException
connect
インタフェース内 I2PSocketManager
peer
- Destination to connect tooptions
- I2P socket options to be used for connecting, may be nulljava.net.NoRouteToHostException
- if the peer is not found or not reachableI2PException
- if there is some other I2P-related problempublic I2PSocket connect(Destination peer) throws I2PException, java.net.NoRouteToHostException
connect
インタフェース内 I2PSocketManager
peer
- Destination to connect tojava.net.NoRouteToHostException
- if the peer is not found or not reachableI2PException
- if there is some other I2P-related problempublic java.net.Socket connectToSocket(Destination peer) throws java.io.IOException
connectToSocket
インタフェース内 I2PSocketManager
java.io.IOException
public java.net.Socket connectToSocket(Destination peer, int timeout) throws java.io.IOException
connectToSocket
インタフェース内 I2PSocketManager
timeout
- ms if > 0, forces blocking (disables connectDelay)java.io.IOException
public void destroySocketManager()
destroySocketManager
インタフェース内 I2PSocketManager
public boolean isDestroyed()
isDestroyed
インタフェース内 I2PSocketManager
public java.util.Set<I2PSocket> listSockets()
listSockets
インタフェース内 I2PSocketManager
public java.lang.String getName()
getName
インタフェース内 I2PSocketManager
public void setName(java.lang.String name)
setName
インタフェース内 I2PSocketManager
public void addDisconnectListener(I2PSocketManager.DisconnectListener lsnr)
addDisconnectListener
インタフェース内 I2PSocketManager
public void removeDisconnectListener(I2PSocketManager.DisconnectListener lsnr)
removeDisconnectListener
インタフェース内 I2PSocketManager