public class ServerSap
extends java.lang.Object
Constructor and Description |
---|
ServerSap(int port,
int backlog,
java.net.InetAddress bindAddr,
javax.net.ServerSocketFactory serverSocketFactory,
ServerSapListener connectionListener)
Use this constructor to create a ServerSAP that can listen on a port with a specified ServerSocketFactory.
|
ServerSap(int port,
ServerSapListener connectionListener)
Use this constructor to create a ServerSAP that listens on the given port using the default ServerSocketFactory.
|
ServerSap(ServerSapListener connectionListener)
Use this constructor to create a ServerSAP that listens on port 2404 using the default ServerSocketFactory.
|
Modifier and Type | Method and Description |
---|---|
void |
setCommonAddressFieldLength(int length)
Sets the length of the Common Address (CA) field of the ASDU.
|
void |
setCotFieldLength(int length)
Sets the length of the Cause Of Transmission (COT) field of the ASDU.
|
void |
setIoaFieldLength(int length)
Sets the length of the Information Object Address (IOA) field of the ASDU.
|
void |
setMaxConnections(int maxConnections)
Set the maximum number of client connections that are allowed in parallel.
|
void |
setMaxIdleTime(int time)
Sets the maximum time in ms that the connection may be idle before sending a test frame.
|
void |
setMaxTimeNoAckReceived(int time)
Sets the maximum time in ms that no acknowledgement has been received (for I-Frames or Test-Frames) before
actively closing the connection.
|
void |
setMaxTimeNoAckSent(int time)
Sets the maximum time in ms before confirming received messages that have not yet been acknowledged using an S
format APDU.
|
void |
setMaxUnconfirmedIPdusReceived(int maxNum)
Sets the number of unacknowledged I format APDUs received before the connection will automatically send an S
format APDU to confirm them.
|
void |
setMessageFragmentTimeout(int timeout)
Sets the message fragment timeout.
|
void |
startListening()
Starts a new thread that listens on the configured port.
|
public ServerSap(ServerSapListener connectionListener)
connectionListener
- the ServerConnectionListener that will be notified when remote clients are connecting or the server
stopped listening.public ServerSap(int port, ServerSapListener connectionListener)
port
- the TCP port that the server will listen on. IEC 60870-5-104 usually uses port 2404.connectionListener
- the ServerConnectionListener that will be notified when remote clients are connecting or the server
stopped listening.public ServerSap(int port, int backlog, java.net.InetAddress bindAddr, javax.net.ServerSocketFactory serverSocketFactory, ServerSapListener connectionListener)
port
- the TCP port that the server will listen on. IEC 60870-5-104 usually uses port 2404.backlog
- is passed to the java.net.ServerSocketbindAddr
- the IP address to bind to. It is passed to java.net.ServerSocketserverSocketFactory
- The ServerSocketFactory to be used to create the ServerSocketconnectionListener
- the ServerConnectionListener that will be notified when remote clients are connecting or the server
stopped listening.public void setMessageFragmentTimeout(int timeout)
interrogation
) will throw
an IOException if the socket throws this timeout. In addition any ASDU listener will be notified of the
IOException. Usually the connection cannot recover from this kind of error.timeout
- the timeout in milliseconds. The default is 5000.public void setCotFieldLength(int length)
length
- the length of the Cause Of Transmission fieldpublic void setCommonAddressFieldLength(int length)
length
- the length of the Common Address (CA) fieldpublic void setIoaFieldLength(int length)
length
- the length of the Information Object Address fieldpublic void setMaxTimeNoAckReceived(int time)
time
- the maximum time in ms that no acknowledgement has been received before actively closing the
connection.public void setMaxTimeNoAckSent(int time)
time
- the maximum time in ms before confirming received messages that have not yet been acknowledged using
an S format APDU.public void setMaxIdleTime(int time)
time
- the maximum time in ms that the connection may be idle before sending a test frame.public void setMaxUnconfirmedIPdusReceived(int maxNum)
maxNum
- the number of unacknowledged I format APDUs received before the connection will automatically send an
S format APDU to confirm them.public void setMaxConnections(int maxConnections)
maxConnections
- the number of connections allowed (default is 100)public void startListening() throws java.io.IOException
java.io.IOException
- if any kind of error occures while creating the server socket.