Package net.i2p.sam
Class SAMv3DatagramSession
java.lang.Object
net.i2p.sam.SAMMessageSession
net.i2p.sam.SAMDatagramSession
net.i2p.sam.SAMv3DatagramSession
- All Implemented Interfaces:
Closeable,AutoCloseable,SAMDatagramReceiver,SAMMessageSess,Session
-
Field Summary
Fields inherited from class net.i2p.sam.SAMDatagramSession
DGRAM_SIZE_MAX, recvFields inherited from class net.i2p.sam.SAMMessageSession
_isOwnSession, _log -
Constructor Summary
ConstructorsConstructorDescriptionSAMv3DatagramSession(String nick, Properties props, SAMv3Handler handler, I2PSession isess, int listenPort, SAMv3DatagramServer dgServer, int version) Build a Datagram Session on an existing i2p session registered with the given nickname Caller MUST call start().SAMv3DatagramSession(String nick, SAMv3DatagramServer dgServer, int version) build a DatagramSession according to informations registered with the given nickname Caller MUST call start(). -
Method Summary
Modifier and TypeMethodDescriptiongetNick()voidreceiveDatagramBytes(Destination sender, byte[] data, int proto, int fromPort, int toPort) Send a byte array to a SAM client.voidreceiveDatagramBytes(Hash sender, byte[] data, int proto, int fromPort, int toPort) Only for Datagram3, where the sender Destination is not available, only the hash.voidStop receiving data.Methods inherited from class net.i2p.sam.SAMDatagramSession
messageReceived, sendBytes, sendBytes, shutDownMethods inherited from class net.i2p.sam.SAMMessageSession
close, getDestination, getI2PSession, getListenPort, getListenProtocol, sendBytesThroughMessageSession, sendBytesThroughMessageSession, startMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.i2p.sam.SAMMessageSess
close, getDestination, getListenPort, getListenProtocol, sendBytes, sendBytes, start
-
Constructor Details
-
SAMv3DatagramSession
public SAMv3DatagramSession(String nick, SAMv3DatagramServer dgServer, int version) throws IOException, DataFormatException, I2PSessionException, SAMException build a DatagramSession according to informations registered with the given nickname Caller MUST call start().- Parameters:
nick- nickname of the sessionversion- datagram version 1/2/3- Throws:
IOExceptionDataFormatExceptionI2PSessionExceptionSAMException
-
SAMv3DatagramSession
public SAMv3DatagramSession(String nick, Properties props, SAMv3Handler handler, I2PSession isess, int listenPort, SAMv3DatagramServer dgServer, int version) throws IOException, DataFormatException, I2PSessionException Build a Datagram Session on an existing i2p session registered with the given nickname Caller MUST call start().- Parameters:
nick- nickname of the sessionversion- datagram version 1/2/3- Throws:
IOExceptionDataFormatExceptionI2PSessionException- Since:
- 0.9.25
-
-
Method Details
-
getNick
-
receiveDatagramBytes
public void receiveDatagramBytes(Destination sender, byte[] data, int proto, int fromPort, int toPort) throws IOException Description copied from interface:SAMDatagramReceiverSend a byte array to a SAM client.- Specified by:
receiveDatagramBytesin interfaceSAMDatagramReceiver- Parameters:
sender- Destinationdata- Byte array to be receivedproto- I2CP protocolfromPort- I2CP from porttoPort- I2CP to port- Throws:
IOException
-
receiveDatagramBytes
public void receiveDatagramBytes(Hash sender, byte[] data, int proto, int fromPort, int toPort) throws IOException Only for Datagram3, where the sender Destination is not available, only the hash.- Specified by:
receiveDatagramBytesin interfaceSAMDatagramReceiver- Parameters:
sender- Hashdata- Byte array to be receivedproto- I2CP protocol, almost certainly 20 (DATAGRAM3)fromPort- I2CP from porttoPort- I2CP to port- Throws:
IOException- Since:
- 0.9.68
-
stopDatagramReceiving
public void stopDatagramReceiving()Description copied from interface:SAMDatagramReceiverStop receiving data.- Specified by:
stopDatagramReceivingin interfaceSAMDatagramReceiver
-