net.i2p.client.streaming
class I2PSocketManagerImpl extends Object implements I2PSocketManager, I2PSessionListener
I2PSocketManager.DisconnectListener
Modifier and Type | Field and Description |
---|---|
static short |
ACK
Deprecated.
|
static short |
CHAFF
Deprecated.
|
static short |
CLOSE_IN
Deprecated.
|
static short |
CLOSE_OUT
Deprecated.
|
static short |
DATA_IN
Deprecated.
|
static short |
DATA_OUT
Deprecated.
|
static short |
SYN
Deprecated.
|
Constructor and Description |
---|
I2PSocketManagerImpl()
Deprecated.
|
I2PSocketManagerImpl(String name)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
addDisconnectListener(I2PSocketManager.DisconnectListener lsnr)
Deprecated.
|
I2PSocketOptions |
buildOptions()
Deprecated.
|
I2PSocketOptions |
buildOptions(Properties opts)
Deprecated.
|
I2PSocket |
connect(Destination peer)
Deprecated.
Create a new connected socket (block until the socket is created)
|
I2PSocket |
connect(Destination peer,
I2PSocketOptions options)
Deprecated.
Create a new connected socket (block until the socket is created)
|
Socket |
connectToSocket(Destination peer)
Deprecated.
Like connect() but returns a real Socket, and throws only IOE,
for easier porting of apps.
|
Socket |
connectToSocket(Destination peer,
int timeout)
Deprecated.
Like connect() but returns a real Socket, and throws only IOE,
for easier porting of apps.
|
void |
destroySocketManager()
Deprecated.
Destroy the socket manager, freeing all the associated resources.
|
void |
disconnected(I2PSession session)
Deprecated.
Notify the client that the session has been terminated
|
void |
errorOccurred(I2PSession session,
String message,
Throwable error)
Deprecated.
Notify the client that some error occurred
|
long |
getAcceptTimeout()
Deprecated.
|
I2PSocketOptions |
getDefaultOptions()
Deprecated.
|
String |
getName()
Deprecated.
|
static String |
getReadableForm(String id)
Deprecated.
|
I2PServerSocket |
getServerSocket()
Deprecated.
|
I2PSession |
getSession()
Deprecated.
|
ServerSocket |
getStandardServerSocket()
Deprecated.
Like getServerSocket but returns a real ServerSocket for easier porting of apps.
|
void |
init(I2PAppContext context,
I2PSession session,
Properties opts,
String name)
Deprecated.
|
Set<I2PSocket> |
listSockets()
Deprecated.
Retrieve a set of currently connected I2PSockets, either initiated locally or remotely.
|
static byte[] |
makePacket(byte type,
String id,
byte[] payload)
Deprecated.
Create a new packet of the given type for the specified connection containing
the given payload
|
void |
messageAvailable(I2PSession session,
int msgId,
long size)
Deprecated.
Instruct the client that the given session has received a message with
size # of bytes.
|
boolean |
ping(Destination peer,
long timeoutMs)
Deprecated.
timeout is ignored - use I2PSocketManagerFull.ping()
|
void |
removeDisconnectListener(I2PSocketManager.DisconnectListener lsnr)
Deprecated.
|
void |
removeSocket(I2PSocketImpl sock)
Deprecated.
|
void |
reportAbuse(I2PSession session,
int severity)
Deprecated.
Instruct the client that the session specified seems to be under attack
and that the client may wish to move its destination to another router.
|
void |
setAcceptTimeout(long ms)
Deprecated.
How long should we wait for the client to .accept() a socket before
sending back a NACK/Close?
|
void |
setDefaultOptions(I2PSocketOptions options)
Deprecated.
|
void |
setName(String name)
Deprecated.
|
void |
setSession(I2PSession session)
Deprecated.
|
public static final short ACK
public static final short CLOSE_OUT
public static final short DATA_OUT
public static final short SYN
public static final short CLOSE_IN
public static final short DATA_IN
public static final short CHAFF
public I2PSocketManagerImpl()
public I2PSocketManagerImpl(String name)
public void init(I2PAppContext context, I2PSession session, Properties opts, String name)
init
in interface I2PSocketManager
public I2PSession getSession()
getSession
in interface I2PSocketManager
public void setSession(I2PSession session)
public void setAcceptTimeout(long ms)
setAcceptTimeout
in interface I2PSocketManager
ms
- milliseconds to wait, maximumpublic long getAcceptTimeout()
getAcceptTimeout
in interface I2PSocketManager
public void disconnected(I2PSession session)
I2PSessionListener
disconnected
in interface I2PSessionListener
public void errorOccurred(I2PSession session, String message, Throwable error)
I2PSessionListener
errorOccurred
in interface I2PSessionListener
error
- can be null? or not?public void messageAvailable(I2PSession session, int msgId, long size)
I2PSessionListener
messageAvailable
in interface I2PSessionListener
session
- session to notifymsgId
- message number availablesize
- size of the message - why it's a long and not an int is a mysterypublic void reportAbuse(I2PSession session, int severity)
I2PSessionListener
reportAbuse
in interface I2PSessionListener
session
- session to report abuse toseverity
- how bad the abuse ispublic void setDefaultOptions(I2PSocketOptions options)
setDefaultOptions
in interface I2PSocketManager
public I2PSocketOptions getDefaultOptions()
getDefaultOptions
in interface I2PSocketManager
public I2PSocketOptions buildOptions()
buildOptions
in interface I2PSocketManager
public I2PSocketOptions buildOptions(Properties opts)
buildOptions
in interface I2PSocketManager
public I2PServerSocket getServerSocket()
getServerSocket
in interface I2PSocketManager
public ServerSocket getStandardServerSocket()
I2PSocketManager
getStandardServerSocket
in interface I2PSocketManager
UnsupportedOperationException
public I2PSocket connect(Destination peer, I2PSocketOptions options) throws I2PException, ConnectException, NoRouteToHostException, InterruptedIOException
connect
in interface I2PSocketManager
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 problempublic I2PSocket connect(Destination peer) throws I2PException, ConnectException, NoRouteToHostException, InterruptedIOException
connect
in interface I2PSocketManager
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 problempublic Socket connectToSocket(Destination peer)
I2PSocketManager
connectToSocket
in interface I2PSocketManager
UnsupportedOperationException
public Socket connectToSocket(Destination peer, int timeout)
I2PSocketManager
connectToSocket
in interface I2PSocketManager
timeout
- ms if > 0, forces blocking (disables connectDelay)UnsupportedOperationException
public void destroySocketManager()
destroySocketManager
in interface I2PSocketManager
public Set<I2PSocket> listSockets()
listSockets
in interface I2PSocketManager
public boolean ping(Destination peer, long timeoutMs)
ping
in interface I2PSocketManager
timeoutMs
- ignoredpeer
- Destination to pingpublic void removeSocket(I2PSocketImpl sock)
public String getName()
getName
in interface I2PSocketManager
public void setName(String name)
setName
in interface I2PSocketManager
public void addDisconnectListener(I2PSocketManager.DisconnectListener lsnr)
addDisconnectListener
in interface I2PSocketManager
public void removeDisconnectListener(I2PSocketManager.DisconnectListener lsnr)
removeDisconnectListener
in interface I2PSocketManager
public static byte[] makePacket(byte type, String id, byte[] payload)