public interface IAnonUDPChannel extends AnonChannel
HTTP, SMTP, SOCKS, TCP, UDP, UDP_OVER_TCP, UDP_OVER_UDP, VPN
Modifier and Type | Method and Description |
---|---|
int |
readPacket(byte[] b,
int off,
int len)
Reads the payload of a whole UDP packet sent from the peer.
|
void |
setDestination(java.lang.String host,
int port) |
void |
setSentAutoFlushDelay(int msAutoFlushDelay)
Sets the time to wait before actually sending some data over this channel
in case the packet belonging to the underlying anonymisation protocol is
not full yet.
|
void |
setSourcePort(int port) |
void |
writePacket(byte[] payload) |
void |
writePacket(byte[] payload,
int offset,
int len) |
close, getInputStream, getOutputBlockSize, getOutputStream, isClosed
void setDestination(java.lang.String host, int port)
host
- the domain name of the target hostport
- the target port numbervoid setSourcePort(int port)
int readPacket(byte[] b, int off, int len) throws java.io.IOException, UDPPacketStreamDesynchronisationException, UDPPacketToLargeException
payload
- off
- len
- java.io.IOException
UDPPacketStreamDesynchronisationException
UDPPacketToLargeException
void writePacket(byte[] payload) throws java.io.IOException
java.io.IOException
void writePacket(byte[] payload, int offset, int len) throws java.io.IOException
java.io.IOException
void setSentAutoFlushDelay(int msAutoFlushDelay)
This method can be used for performance optimisations / efficiency. One
use case would be if you know that this channel will sent data
immediately after connection establishment. Therefore you would call
setSentAutoFlushDelay
with some delayvalue > 0
just before you call the connect
method. If you call
Outputstream.write
within delayvalue
milliseconds after the connect
call then the data you intend
to sent will be piggybacked on the connect request. This will save some
roundtrip-time delay.
Additionally, using this method correctly could decrease the bandwidth overhead introduced by the underlying anonymisation protocol. Many anonymisation protocols fragment the data stream into fixed sized packets which are filled with dummy data if not enough real data is available. Therefore waiting a certain amount of time for additional real data can increase the channel utilisation.
Note: This method will not do anything at the moment as the implementation is not ready yet.
msAutoFlushDelay
- the amount of time in milliseconds to wait for new data before
the current sent buffer is flushed. Setting this value to
0
will always auto flush immediately. Setting this
value to -1
will only flush the sent buffer, if the
sent buffer is full, i.e. getOutputBufgferSize many bytes are
contained in the buffer.Copyright © 2023. All rights reserved.