Interface Transport
- All Superinterfaces:
TransportBase
- All Known Implementing Classes:
NetworkConnectionImpl.bogusTransport, TCPTransportImpl, TransportImpl, UDPTransport
Represents a peer Transport connection (eg. a network socket).
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceListener for notification of connection establishment. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final Objectstatic final intstatic final intstatic final intstatic final int -
Method Summary
Modifier and TypeMethodDescriptionvoidbindConnection(NetworkConnection connection) voidClose the transport connection.voidIndicate that inbound connection is completevoidconnectOutbound(ByteBuffer initial_data, Transport.ConnectListener listener, int priority) Kick off an outbound connectiongetEncryption(boolean verbose) Return a textual description of the encryption for this transportintGet the socket channel used by the transport.default intDeprecated.getUserData(Object key) booleanisClosed()booleanbooleanisSOCKS()longread(ByteBuffer[] buffers, int array_offset, int length) Read data from the transport into the given buffers.voidsetAlreadyRead(ByteBuffer bytes_already_read) Inject the given already-read data back into the read stream.voidfake a wakeup so that a read cycle is attemptedvoidsetTrace(boolean on) default voidsetTransportMode(int mode) default voidsetTransportModes(int send_mode, int recv_mode) Set the transport to the given speed modes.voidsetUserData(Object key, Object value) voidunbindConnection(NetworkConnection connection) longwrite(ByteBuffer[] buffers, int array_offset, int length) Write data to the transport from the given buffers.Methods inherited from interface TransportBase
getDescription, isReadyForRead, isReadyForWrite, isTCP
-
Field Details
-
KEY_CLOSE_REASON
-
CR_NONE
static final int CR_NONE- See Also:
-
CR_DUPLICATE_PEER_ID
static final int CR_DUPLICATE_PEER_ID- See Also:
-
CR_STOPPED_OR_REMOVED
static final int CR_STOPPED_OR_REMOVED- See Also:
-
CR_NO_MEMORY
static final int CR_NO_MEMORY- See Also:
-
CR_PORT_BLOCKED
static final int CR_PORT_BLOCKED- See Also:
-
CR_IP_BLOCKED
static final int CR_IP_BLOCKED- See Also:
-
CR_UPLOAD_TO_UPLOAD
static final int CR_UPLOAD_TO_UPLOAD- See Also:
-
CR_NOT_INTERESTED_UPLOAD_ONLY
static final int CR_NOT_INTERESTED_UPLOAD_ONLY- See Also:
-
CR_TIMEOUT
static final int CR_TIMEOUT- See Also:
-
CR_TIMEOUT_INTEREST
static final int CR_TIMEOUT_INTEREST- See Also:
-
CR_TIMEOUT_ACTIVITY
static final int CR_TIMEOUT_ACTIVITY- See Also:
-
CR_TIMEOUT_HANDSHAKE
static final int CR_TIMEOUT_HANDSHAKE- See Also:
-
CR_TIMEOUT_REQUEST
static final int CR_TIMEOUT_REQUEST- See Also:
-
CR_PROTOCOL_BLOCKED
static final int CR_PROTOCOL_BLOCKED- See Also:
-
CR_PEER_CHURN
static final int CR_PEER_CHURN- See Also:
-
CR_TOO_MANY_CONNECTIONS
static final int CR_TOO_MANY_CONNECTIONS- See Also:
-
CR_TOO_MANY_FILES
static final int CR_TOO_MANY_FILES- See Also:
-
CR_INVALID_INFO_HASH
static final int CR_INVALID_INFO_HASH- See Also:
-
CR_SELF_CONNECTION
static final int CR_SELF_CONNECTION- See Also:
-
CR_BAD_PIECE_DATA
static final int CR_BAD_PIECE_DATA- See Also:
-
CR_INTERNAL_CONNECT_FAILED
static final int CR_INTERNAL_CONNECT_FAILED- See Also:
-
TRANSPORT_MODE_NORMAL
static final int TRANSPORT_MODE_NORMAL- See Also:
-
TRANSPORT_MODE_FAST
static final int TRANSPORT_MODE_FAST- See Also:
-
TRANSPORT_MODE_TURBO
static final int TRANSPORT_MODE_TURBO- See Also:
-
TRANSPORT_MODE_MEGA_TURBO
static final int TRANSPORT_MODE_MEGA_TURBO- See Also:
-
-
Method Details
-
getMssSize
int getMssSize() -
setAlreadyRead
Inject the given already-read data back into the read stream.- Parameters:
bytes_already_read- data
-
getTransportStartpoint
TransportStartpoint getTransportStartpoint() -
getTransportEndpoint
TransportEndpoint getTransportEndpoint()Get the socket channel used by the transport.- Returns:
- the socket channel
-
isEncrypted
boolean isEncrypted() -
getEncryption
Return a textual description of the encryption for this transport- Returns:
-
getProtocol
String getProtocol() -
isSOCKS
boolean isSOCKS() -
getPluginProxy
AEProxyFactory.PluginProxy getPluginProxy() -
setReadyForRead
void setReadyForRead()fake a wakeup so that a read cycle is attempted -
write
Write data to the transport from the given buffers. NOTE: Works like GatheringByteChannel.- Parameters:
buffers- from which bytes are to be retrievedarray_offset- offset within the buffer array of the first buffer from which bytes are to be retrievedlength- maximum number of buffers to be accessed- Returns:
- number of bytes written
- Throws:
IOException- on write error
-
read
Read data from the transport into the given buffers. NOTE: Works like ScatteringByteChannel.- Parameters:
buffers- into which bytes are to be placedarray_offset- offset within the buffer array of the first buffer into which bytes are to be placedlength- maximum number of buffers to be accessed- Returns:
- number of bytes read
- Throws:
IOException- on read error
-
setTransportModes
default void setTransportModes(int send_mode, int recv_mode) Set the transport to the given speed modes.- Parameters:
mode- to change to
-
getTransportMode
default int getTransportMode()Deprecated.Get the transport's speed mode.- Returns:
- current mode
-
setTransportMode
default void setTransportMode(int mode) -
connectOutbound
Kick off an outbound connection- Parameters:
listener-
-
connectedInbound
void connectedInbound()Indicate that inbound connection is complete -
close
Close the transport connection. -
isClosed
boolean isClosed() -
bindConnection
-
unbindConnection
-
getUserData
-
setUserData
-
setTrace
void setTrace(boolean on)
-