|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface TransportOperations
The interface for a Transport object, which provides operations for sending and receiving octet streams. In addition, it is possible to register callbacks with the Transport object, which are invoked whenever data can be sent or received without blocking.
Connector
,
Acceptor
Method Summary | |
---|---|
void |
close()
Closes the Transport. |
TransportInfo |
get_info()
Returns the information object associated with the Transport. |
int |
handle()
The "handle" for this Transport. |
String |
id()
The plugin id. |
SendReceiveMode |
mode()
The send/receive capabilities of this Transport. |
boolean |
receive_detect(Buffer buf,
boolean block)
Similar to receive , but it signals a connection
loss by returning FALSE instead of raising
COMM_FAILURE . |
boolean |
receive_timeout_detect(Buffer buf,
int timeout)
Similar to receive_timeout , but it signals a
connection loss by returning FALSE instead of
raising COMM_FAILURE . |
void |
receive_timeout(Buffer buf,
int timeout)
Similar to receive , but it is
possible to specify a timeout. |
void |
receive(Buffer buf,
boolean block)
Receives a buffer's contents. |
boolean |
send_detect(Buffer buf,
boolean block)
Similar to send , but it signals a connection loss
by returning FALSE instead of raising
COMM_FAILURE . |
boolean |
send_timeout_detect(Buffer buf,
int timeout)
Similar to send_timeout , but it signals a
connection loss by returning FALSE instead of
raising COMM_FAILURE . |
void |
send_timeout(Buffer buf,
int timeout)
Similar to send , but it is possible
to specify a timeout. |
void |
send(Buffer buf,
boolean block)
Sends a buffer's contents. |
void |
shutdown()
Shutdown the Transport. |
int |
tag()
The profile id tag. |
Method Detail |
---|
String id()
int tag()
SendReceiveMode mode()
int handle()
select()
on
Unix-based operating systems. All other uses (e.g., calls to
read()
, write()
,
close()
) are strictly non-compliant. A handle
value of -1 indicates that the protocol plug-in does not
support "selectable" Transports.
void close()
close
, no
operations on this Transport object and its associated
TransportInfo object may be called. To ensure that no messages
get lost when close
is called,
shutdown
should be called first. Then dummy data
should be read from the Transport, using one of the
receive
operations, until either an exception is
raised, or until connection closure is detected. After that its
save to call close
, i.e., no messages can get
lost.
COMM_FAILURE
- In case of an error.void shutdown()
receive
operations will return or
throw an exception. After calling shutdown
, no
operations on associated TransportInfo object may be called. To
fully close the Transport, close
must be called.
COMM_FAILURE
- In case of an error.void receive(Buffer buf, boolean block)
buf
- The buffer to fill.block
- If set to TRUE
, the operation blocks
until the buffer is full. If set to FALSE
, the
operation fills as much of the buffer as possible without
blocking.
COMM_FAILURE
- In case of an error.boolean receive_detect(Buffer buf, boolean block)
receive
, but it signals a connection
loss by returning FALSE
instead of raising
COMM_FAILURE
.
buf
- The buffer to fill.block
- If set to TRUE
, the operation blocks
until the buffer is full. If set to FALSE
, the
operation fills as much of the buffer as possible without
blocking.
FALSE
if a connection loss is
detected, TRUE
otherwise.
COMM_FAILURE
- In case of an error.void receive_timeout(Buffer buf, int timeout)
receive
, but it is
possible to specify a timeout. On return the caller can test
whether there was a timeout by checking if the buffer has
been filled completely.
buf
- The buffer to fill.timeout
- The timeout value in milliseconds. A zero
timeout is equivalent to calling receive(buf, FALSE)
.
COMM_FAILURE
- In case of an error.boolean receive_timeout_detect(Buffer buf, int timeout)
receive_timeout
, but it signals a
connection loss by returning FALSE
instead of
raising COMM_FAILURE
.
buf
- The buffer to fill.timeout
- The timeout value in milliseconds. A zero
timeout is equivalent to calling receive(buf, FALSE)
.
FALSE
if a connection loss is
detected, TRUE
otherwise.
COMM_FAILURE
- In case of an error.void send(Buffer buf, boolean block)
buf
- The buffer to send.block
- If set to TRUE
, the operation blocks
until the buffer has completely been sent. If set to
FALSE
, the operation sends as much of the buffer's
data as possible without blocking.
COMM_FAILURE
- In case of an error.boolean send_detect(Buffer buf, boolean block)
send
, but it signals a connection loss
by returning FALSE
instead of raising
COMM_FAILURE
.
buf
- The buffer to fill.block
- If set to TRUE
, the operation blocks
until the entire buffer has been sent. If set to
FALSE
, the operation sends as much of the buffer's
data as possible without blocking.
FALSE
if a connection loss is
detected, TRUE
otherwise.
COMM_FAILURE
- In case of an error.void send_timeout(Buffer buf, int timeout)
send
, but it is possible
to specify a timeout. On return the caller can test whether
there was a timeout by checking if the buffer has
been sent completely.
buf
- The buffer to send.timeout
- The timeout value in milliseconds. A zero
timeout is equivalent to calling send(buf, FALSE)
.
COMM_FAILURE
- In case of an error.boolean send_timeout_detect(Buffer buf, int timeout)
send_timeout
, but it signals a
connection loss by returning FALSE
instead of
raising COMM_FAILURE
.
buf
- The buffer to fill.timeout
- The timeout value in milliseconds. A zero
timeout is equivalent to calling send(buf, FALSE)
.
FALSE
if a connection loss is
detected, TRUE
otherwise.
COMM_FAILURE
- In case of an error.TransportInfo get_info()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |