class SAMDatagramSession extends SAMMessageSession
| Modifier and Type | Field and Description |
|---|---|
static int |
DGRAM_SIZE_MAX |
protected SAMDatagramReceiver |
recv |
_isOwnSession, _log| Modifier | Constructor and Description |
|---|---|
protected |
SAMDatagramSession(I2PSession sess,
Properties props,
int listenPort,
SAMDatagramReceiver recv)
Create a new SAM DATAGRAM session on an existing I2P session.
|
|
SAMDatagramSession(InputStream destStream,
Properties props,
SAMDatagramReceiver recv)
Create a new SAM DATAGRAM session.
|
protected |
SAMDatagramSession(String dest,
Properties props,
SAMDatagramReceiver recv)
Create a new SAM DATAGRAM session.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
messageReceived(byte[] msg,
int proto,
int fromPort,
int toPort)
Handle a new received message
|
boolean |
sendBytes(String dest,
byte[] data,
int proto,
int fromPort,
int toPort)
Send bytes through a SAM DATAGRAM session.
|
boolean |
sendBytes(String dest,
byte[] data,
int proto,
int fromPort,
int toPort,
boolean sendLeaseSet,
int sendTags,
int tagThreshold,
int expiration)
Send bytes through a SAM DATAGRAM session.
|
protected void |
shutDown()
Do whatever is needed to shutdown the SAM session
|
close, getDestination, getI2PSession, getListenPort, getListenProtocol, sendBytesThroughMessageSession, sendBytesThroughMessageSession, startpublic static final int DGRAM_SIZE_MAX
protected SAMDatagramReceiver recv
protected SAMDatagramSession(I2PSession sess, Properties props, int listenPort, SAMDatagramReceiver recv) throws IOException, DataFormatException, I2PSessionException
props - unused for nowIOExceptionDataFormatExceptionI2PSessionExceptionpublic SAMDatagramSession(InputStream destStream, Properties props, SAMDatagramReceiver recv) throws IOException, DataFormatException, I2PSessionException
destStream - Input stream containing the destination keysprops - Properties to setup the I2P sessionrecv - Object that will receive incoming dataIOExceptionDataFormatExceptionI2PSessionExceptionprotected SAMDatagramSession(String dest, Properties props, SAMDatagramReceiver recv) throws IOException, DataFormatException, I2PSessionException
dest - Base64-encoded destination (private key)props - Properties to setup the I2P sessionrecv - Object that will receive incoming dataIOExceptionDataFormatExceptionI2PSessionExceptionprotected void messageReceived(byte[] msg,
int proto,
int fromPort,
int toPort)
SAMMessageSessionmessageReceived in class SAMMessageSessionmsg - Message payloadpublic boolean sendBytes(String dest, byte[] data, int proto, int fromPort, int toPort) throws DataFormatException, I2PSessionException
sendBytes in interface SAMMessageSesssendBytes in class SAMMessageSessiondest - Destinationdata - Bytes to be sentproto - ignored, will always use PROTO_DATAGRAM (17)DataFormatException - on unknown / bad destI2PSessionException - on serious error, probably session closedpublic boolean sendBytes(String dest, byte[] data, int proto, int fromPort, int toPort, boolean sendLeaseSet, int sendTags, int tagThreshold, int expiration) throws DataFormatException, I2PSessionException
protected void shutDown()
SAMMessageSessionshutDown in class SAMMessageSession