public interface Channel
Channel
object is internally managed by the ETA Transport Package, and the
application does not need to create nor destroy any memory associated with a
Channel
. The Channel
is typically used to perform any action
on the connection that it represents (e.g. reading, writing, disconnecting, * etc).Modifier and Type | Method and Description |
---|---|
boolean |
blocking()
The blocking mode of the channel.
|
int |
bufferUsage(Error error)
Returns the total number of used buffers for this channel.
Typical use: This method can be called to find out the number of used buffers for the calling channel. |
int |
close(Error error)
Closes a Channel.
Typical use: When done using a Channel, this call closes it. |
int |
connectionType()
The connection type associated with the
Channel . |
default int |
encryptedConnectionType()
Encrypted connection type associated with the
Channel . |
int |
flush(Error error)
Flushes data waiting to be written on a given channel.
Typical use: This method pushes the data in the write buffer out to the network. |
TransportBuffer |
getBuffer(int size,
boolean packedBuffer,
Error error)
Retrieves a
TransportBuffer for use.Typical use: This is called when a buffer is needed to write data to. |
java.lang.String |
hostname()
For NIProvider and Consumer applications, remote server host name associated with the
Channel . |
int |
info(ChannelInfo info,
Error error)
Gets information about the channel.
Typical use: If information about the Channel is needed, such as
maxFragmentSize or maxOutputBuffers, this method can be called to retrieve this information. |
int |
init(InProgInfo inProg,
Error error)
Continues channel initialization for non-blocking channels.
Typical use: 1. |
int |
ioctl(int code,
int value,
Error error)
Allows changing some I/O values programmatically.
|
int |
ioctl(int code,
java.lang.Object value,
Error error)
Allows changing some I/O values programmatically.
|
int |
majorVersion()
When a
Channel becomes active for a client or server, this is
populated with the negotiated major version number that is associated
with the content being sent on this connection. |
int |
minorVersion()
When a
Channel becomes active for a client or server, this is
populated with the negotiated minor version number that is associated
with the content being sent on this connection. |
java.nio.channels.SocketChannel |
oldScktChannel()
Deprecated.
use
oldSelectableChannel() instead |
java.nio.channels.SelectableChannel |
oldSelectableChannel()
It is possible for a channel to change over time, typically due to
some kind of connection keep-alive mechanism.
|
int |
packBuffer(TransportBuffer buffer,
Error error)
Allows user to pack multiple ETA encoded messages into the same ETA Buffer.
Typical use: This is called when the application wants to perform message packing. |
int |
ping(Error error)
Sends a heartbeat message.
Typical use: This method is called to send some type of ping or heartbeat message. |
int |
pingTimeout()
When a
Channel becomes active for a client or server, this is
populated with the negotiated ping timeout value. |
default int |
port()
For NIProvider and Consumer applications, remote server port number associated with the
Channel . |
int |
protocolType()
When a
Channel becomes active for a client or server, this is
populated with the protocolType associated with the content being sent on
this connection. |
TransportBuffer |
read(ReadArgs readArgs,
Error error)
Reads on a given channel.
Typical use: This method is called and returns a buffer with any data read from the channel. |
int |
reconnectClient(Error error)
Used for tunneling solutions to reconnect and bridge connections.
|
int |
releaseBuffer(TransportBuffer buffer,
Error error)
Releases a
TransportBuffer after use.A buffer obtained through getBuffer() call is returned to the buffer pool by write() method or releaseBuffer() method. |
java.nio.channels.SocketChannel |
scktChannel()
Deprecated.
use
selectableChannel() instead |
java.nio.channels.SelectableChannel |
selectableChannel()
java.nio.channels.SelectableChannel of the channel.
|
int |
state()
The state associated with the
Channel . |
java.lang.Object |
userSpecObject()
A user specified object, possibly a closure.This value can be set
directly or via the connection options and is not modified by the
transport.
|
int |
write(TransportBuffer buffer,
WriteArgs writeArgs,
Error error)
Writes on a given channel.
Typical use: This method is called after buffer is populated with a message. |
int info(ChannelInfo info, Error error)
Channel
is needed, such as
maxFragmentSize or maxOutputBuffers, this method can be called to retrieve this information.
If the channel is closed by the far end, this method returns error and the channel state is set to CLOSED.info
- Channel Info structure to be populatederror
- Error, to be populated in event of an errorTransportReturnCodes
ChannelInfo
int ioctl(int code, java.lang.Object value, Error error)
Valid codes are:
code
- IoctlCodes
code of I/O Option to changevalue
- Value to change Option toerror
- Error
to be populated in event of an errorTransportReturnCodes
IoctlCodes
int ioctl(int code, int value, Error error)
Valid codes are:
IoctlCodes.MAX_NUM_BUFFERS
- the return code will be the new
value of maxOutputBuffers or TransportReturnCodes.FAILURE
. If the
specified value is less than guaranteedOutputBuffers, the
guaranteedOutputBuffers value will be used.IoctlCodes.NUM_GUARANTEED_BUFFERS
- the return code will be
the new value of guarenteedOutputBuffers or
TransportReturnCodes.FAILURE
. If the specified value is larger
than maxOutputBuffers, maxOutputBuffers will be set to the value. If the
value is less than the number of free buffers in the guaranteed pool (due
to buffers being in use), the guaranteed pool will be reduced by the
number of free buffers.IoctlCodes.HIGH_WATER_MARK
IoctlCodes.SYSTEM_READ_BUFFERS
- for values larger than 64K,
use ConnectOptions.sysRecvBufSize(int)
to set the receive buffer
size, prior to calling Transport.connect(ConnectOptions, Error)
.IoctlCodes.SYSTEM_WRITE_BUFFERS
IoctlCodes.COMPRESSION_THRESHOLD
code
- IoctlCodes
code of I/O Option to change.value
- Value to change Option toerror
- Error
to be populated in event of an errorTransportReturnCodes
or a positive number specific to the specified code.ChannelInfo
int bufferUsage(Error error)
error
- Error, to be populated in event of an errorTransportReturnCodes
,
otherwise it is the total number of buffers in use by this channelint init(InProgInfo inProg, Error error)
inProg
- InProg Info for compatibility mode reconnectionerror
- Error, to be populated in event of an errorTransportReturnCodes
InProgInfo
,
ChannelState
int close(Error error)
error
- Error, to be populated in event of an errorTransportReturnCodes
TransportBuffer read(ReadArgs readArgs, Error error)
ReadArgs.readRetVal()
a positive value if there is more
data to read, TransportReturnCodes.READ_WOULD_BLOCK
if the read
call is blocked, or a failure code. If the socket of the channel is closed
by the far end, this method returns error and the channel state is set to CLOSED.readArgs
- read argumentserror
- Error, to be populated in event of an errorReadArgs
TransportBuffer getBuffer(int size, boolean packedBuffer, Error error)
TransportBuffer
for use.TransportBuffer
structure and then pass it to the write method.size
- Size of the requested bufferpackedBuffer
- Set to true if you plan on packing multiple messages into the same buffererror
- Error, to be populated in event of an errorTransportBuffer
int releaseBuffer(TransportBuffer buffer, Error error)
TransportBuffer
after use.buffer
- buffer to be releasederror
- Error, to be populated in event of an errorTransportReturnCodes
TransportBuffer
int packBuffer(TransportBuffer buffer, Error error)
buffer
- buffer to be packederror
- Error, to be populated in event of an errorTransportReturnCodes
or the amount of available bytes remaining in the buffer for packing.TransportBuffer
int write(TransportBuffer buffer, WriteArgs writeArgs, Error error)
buffer
- Buffer to write to the networkwriteArgs
- Arguments for writing the buffer (WriteArgs)error
- Error, to be populated in event of an errorTransportReturnCodes
or the number of bytes pending flushWriteArgs
int flush(Error error)
error
- Error, to be populated in event of an errorTransportReturnCodes
or the number of bytes pending flushint ping(Error error)
error
- Error, to be populated in event of an errorTransportReturnCodes
or the number of bytes pending flushint majorVersion()
Channel
becomes active for a client or server, this is
populated with the negotiated major version number that is associated
with the content being sent on this connection. Typically, a major
version increase is associated with the introduction of incompatible
change. The transport layer is data neutral and does not change nor
depend on any information in content being distributed. This information
is provided to help client and server applications manage the information
they are communicating.int minorVersion()
Channel
becomes active for a client or server, this is
populated with the negotiated minor version number that is associated
with the content being sent on this connection. Typically, a minor
version increase is associated with a fully backward compatible change or
extension. The transport layer is data neutral and does not change nor
depend on any information in content being distributed. This information
is provided to help client and server applications manage the information
they are communicating.int protocolType()
Channel
becomes active for a client or server, this is
populated with the protocolType associated with the content being sent on
this connection. If the protocolType indicated by a server does not match
the protocolType that a client specifies, the connection will be
rejected. The transport layer is data neutral and does not change nor
depend on any information in content being distributed. This information
is provided to help client and server applications manage the information
they are communicating.int state()
Channel
. Until the channel has
completed its initialization handshake and has transitioned to an active
state, no reading or writing can be performed.ChannelState
@Deprecated java.nio.channels.SocketChannel scktChannel()
selectableChannel()
instead@Deprecated java.nio.channels.SocketChannel oldScktChannel()
oldSelectableChannel()
insteadTransportReturnCodes.READ_FD_CHANGE
. The previous socketId is
stored in oldSocketId so the application can properly unregister and then
register the new socketId with their I/O notification mechanism.java.nio.channels.SelectableChannel selectableChannel()
java.nio.channels.SelectableChannel oldSelectableChannel()
TransportReturnCodes.READ_FD_CHANGE
. The previous socketId is
stored in oldSocketId so the application can properly unregister and then
register the new socketId with their I/O notification mechanism.int pingTimeout()
Channel
becomes active for a client or server, this is
populated with the negotiated ping timeout value. This is the number of
seconds after which no communication can result in a connection being
terminated. Both client and server applications should send heartbeat
information within this interval. The typically used rule of thumb is to
send a heartbeat every pingTimeout/3 seconds.java.lang.Object userSpecObject()
Channel
with other user created information, such as a watch list
associated with this connection.boolean blocking()
int reconnectClient(Error error)
error
- Error, to be populated in event of an errorTransportReturnCodes
int connectionType()
Channel
.ConnectionTypes
java.lang.String hostname()
Channel
.default int port()
Channel
.
Relevant for Socket connection, zero for otherdefault int encryptedConnectionType()
Channel
. This method is used when connectionType()
is ConnectionTypes.ENCRYPTED
Copyright @ 2022 Refinitiv. All Rights Reserved.