public final class TConnection extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
byte[] |
tSelLocal |
byte[] |
tSelRemote |
| 限定符和类型 | 方法和说明 |
|---|---|
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() |
boolean |
getSocketIsbind() |
boolean |
getSocketIsConnected() |
boolean |
getSocketIsInputShutdown() |
boolean |
getSocketIsOpen() |
boolean |
getSocketIsOutputShutdown() |
void |
receive(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(List<byte[]> tsdus,
List<Integer> offsets,
List<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.
|
boolean |
testConnected() |
public void send(List<byte[]> tsdus, List<Integer> offsets, List<Integer> lengths) throws IOException
IOExceptionpublic void send(byte[] tsdu,
int offset,
int length)
throws IOException
IOExceptionpublic int getMessageTimeout()
public void setMessageTimeout(int messageTimeout)
messageTimeout - in millisecondspublic int getMessageFragmentTimeout()
public void setMessageFragmentTimeout(int messageFragmentTimeout)
messageFragmentTimeout - in millisecondspublic void receive(ByteBuffer tSduBuffer) throws EOFException, SocketTimeoutException, IOException, TimeoutException
tSduBuffer - the buffer that is filled with the received TSDU data.EOFException - if a Disconnect Request (DR) was received or the socket was simply closedSocketTimeoutException - if a messageFragmentTimeout is thrown by the socket while
receiving the remainder of a messageIOException - 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.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()
public boolean getSocketIsOpen()
public boolean getSocketIsConnected()
public boolean getSocketIsInputShutdown()
public boolean getSocketIsOutputShutdown()
public boolean getSocketIsbind()
public boolean testConnected()
Copyright © 2025. All rights reserved.