public static final class Master.TcpBuilder
extends java.lang.Object
Master associations built using the same builder share resources (e.g. thread pools) and can listen identical ports for TCP connections.
Modifier and Type | Method | Description |
---|---|---|
Master |
build() |
Create a master association.
|
Master.TcpBuilder |
endPointType(TcpEndPointType type) |
Sets the master's end point type.
|
Master.TcpBuilder |
eventListener(Master.EventListener eventListener) |
Sets the lister that is notified of incoming DNP3 event data.
|
Master.TcpBuilder |
linkStatusRequestTimeout(java.time.Duration duration) |
Sets the maximum idle duration after which a link status message is requested.
|
Master.TcpBuilder |
linkStatusResponseTimeout(java.time.Duration duration) |
Sets the time to wait for a link status after having sent a link status request.
|
Master.TcpBuilder |
listeningPort(int port) |
Sets the port to listen for an incoming connection by the outstation.
|
Master.TcpBuilder |
localAddress(java.net.InetAddress localAddress) |
Sets the local IP address.
|
Master.TcpBuilder |
masterDlAddress(int address) |
Sets the master data link address.
|
Master.TcpBuilder |
maxReceiveMessageFragmentSize(int size) |
Sets the maximum message fragment size that can be received.
|
Master.TcpBuilder |
maxSendMessageFragmentSize(int size) |
Sets the maximum message fragment size for sending.
|
Master.TcpBuilder |
outstationDlAddress(int address) |
Sets the outstation data link address.
|
Master.TcpBuilder |
outstationHost(java.lang.String host) |
Sets the host name or IP address of the outstation.
|
Master.TcpBuilder |
outstationPort(int port) |
Sets the port of the outstation to connect to.
|
Master.TcpBuilder |
reconnectInterval(java.time.Duration duration) |
Sets the reconnect interval.
|
Master.TcpBuilder |
reset() |
Resets all parameters of this builder to their default value.
|
Master.TcpBuilder |
responseFragmentTimeout(java.time.Duration duration) |
Sets the response fragment timeout.
|
Master.TcpBuilder |
tcpConnectionListener(TcpConnectionListener listener) |
Sets the lister that is notified of TCP connection events.
|
public Master.TcpBuilder reset()
public Master.TcpBuilder outstationHost(java.lang.String host)
host
- the host name or IP address of the outstationpublic Master.TcpBuilder outstationPort(int port)
port
- the port to connect topublic Master.TcpBuilder listeningPort(int port)
port
- the port to listen for an incoming connection by the outstationpublic Master.TcpBuilder localAddress(java.net.InetAddress localAddress)
InetAddress
. Specifying
null
is equivalent to passing the wildcard address. The wildcard address will cause 1) the
system to choose the a valid IP for initiating connections and 2) to listen on all available
interfaces when listening for connections.localAddress
- the local IP address, or null for the wildcard addresspublic Master.TcpBuilder endPointType(TcpEndPointType type)
INITIATING
.type
- the end point typepublic Master.TcpBuilder reconnectInterval(java.time.Duration duration)
A duration equal to Duration.ZERO
disables reconnection. The default is 5 seconds.
duration
- the reconnect intervalpublic Master.TcpBuilder tcpConnectionListener(TcpConnectionListener listener)
null
disables
notification.listener
- the listener that is notified of TCP connection eventspublic Master.TcpBuilder masterDlAddress(int address)
address
- the master data link addresspublic Master.TcpBuilder outstationDlAddress(int address)
address
- the outstation data link addresspublic Master.TcpBuilder linkStatusRequestTimeout(java.time.Duration duration)
Link status messages are also called keep-alive or heartbeat messages. DNP3's link layer will send link status requests after the connection was idle (no messages have been exchanged) for the given duration. Any data link message received will reset the timer for sending link status requests.
Set to Duration.ZERO
to disable link status requests. Default is 60s.
duration
- idle duration after which a link status message is requestedpublic Master.TcpBuilder linkStatusResponseTimeout(java.time.Duration duration)
A duration equal to Duration.ZERO
disables waiting for link status response
messages. In this case is does not matter if a link status reply is received. The default
timeout is 10s.
If no link status message is received on time, the TCP connection is closed before attempting to reconnect again (through initiation and/or listening).
duration
- the time to wait for a link status responsepublic Master.TcpBuilder maxSendMessageFragmentSize(int size)
size
- the maximum message fragment size for sendingpublic Master.TcpBuilder maxReceiveMessageFragmentSize(int size)
size
- the maximum message fragment size that can be receivedpublic Master.TcpBuilder responseFragmentTimeout(java.time.Duration duration)
Dnp3TimeoutException
is thrown by the request method.
A duration equal to Duration.ZERO
disables the timeout. The default is 5 seconds.
duration
- the response fragment timeoutpublic Master.TcpBuilder eventListener(Master.EventListener eventListener)
null
disables
notification.eventListener
- the listenerpublic Master build() throws ListeningEndPointException
ListeningEndPointException
- If the listening end point cannot be started, e.g. because
the port is occupied. Cannot be thrown if no listening end point was configured.