public final class TConnection
extends java.lang.Object
Modifier and Type | Field | Description |
---|---|---|
byte[] |
tSelLocal |
|
byte[] |
tSelRemote |
Modifier and Type | Method | Description |
---|---|---|
void |
close() |
Will close the TCP connection if its still open and free any resources of this connection.
|
void |
disconnect() |
This function sends a Disconnect Request but does not wait for a Disconnect Confirm.
|
int |
getMessageFragmentTimeout() |
|
int |
getMessageTimeout() |
|
void |
receive(java.nio.ByteBuffer tSduBuffer) |
Listens for a new TPDU and writes the extracted TSDU into the passed buffer.
|
void |
send(byte[] tsdu,
int offset,
int length) |
|
void |
send(java.util.List<byte[]> tsdus,
java.util.List<java.lang.Integer> offsets,
java.util.List<java.lang.Integer> lengths) |
|
void |
setMessageFragmentTimeout(int messageFragmentTimeout) |
Set the TConnection timeout for receiving data once the beginning of a message has been
received.
|
void |
setMessageTimeout(int messageTimeout) |
Set the TConnection timeout for waiting for the first byte of a new message.
|
public void send(java.util.List<byte[]> tsdus, java.util.List<java.lang.Integer> offsets, java.util.List<java.lang.Integer> lengths) throws java.io.IOException
java.io.IOException
public void send(byte[] tsdu, int offset, int length) throws java.io.IOException
java.io.IOException
public int getMessageTimeout()
public void setMessageTimeout(int messageTimeout)
messageTimeout
- in millisecondspublic int getMessageFragmentTimeout()
public void setMessageFragmentTimeout(int messageFragmentTimeout)
messageFragmentTimeout
- in millisecondspublic void receive(java.nio.ByteBuffer tSduBuffer) throws java.io.EOFException, java.net.SocketTimeoutException, java.io.IOException, java.util.concurrent.TimeoutException
tSduBuffer
- the buffer that is filled with the received TSDU data.java.io.EOFException
- if a Disconnect Request (DR) was received or the socket was simply closedjava.net.SocketTimeoutException
- if a messageFragmentTimeout is thrown by the socket while
receiving the remainder of a messagejava.io.IOException
- if an ErrorPDU (ER) was received, any syntax error in the received message
header was detected or the tSduBuffer is too small to hold the complete PDU.java.util.concurrent.TimeoutException
- this exception is thrown if the first byte of new message is not
received within the message timeout.public void disconnect()
public void close()