public static class DlmsServer.TcpServerBuilder
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
DlmsServer |
build()
Builds a new server and starts it, with the provided settings.
|
T |
registerLogicalDevice(java.util.List<LogicalDevice> newlogicalDevices)
Register list of logical devices to the server.
|
T |
registerLogicalDevice(LogicalDevice... logicalDevice)
Register one or more logical devices to the server.
|
T |
setConnectionListener(ServerConnectionListener connectionListener) |
T |
setInactivityTimeout(int inactivityTimeout)
Sets the inactivity timeout.
|
T |
setMaxClients(int maxClients)
Restrict the maximum number of connected clients.
|
T |
setResponseTimeout(int responseTimeout)
The max time a server waits for a response from the client, after sending a request to the client.
|
DlmsServer.TcpServerBuilder |
setTcpPort(int port)
The port a client may access the server.
|
public DlmsServer.TcpServerBuilder setTcpPort(int port)
port
- the TCP port the server starts listening on.public DlmsServer build() throws java.io.IOException
java.io.IOException
- if an I/O exception occurs while starting the server.public final T registerLogicalDevice(LogicalDevice... logicalDevice)
logicalDevice
- a logical device.public T registerLogicalDevice(java.util.List<LogicalDevice> newlogicalDevices)
newlogicalDevices
- a list of logical devices.public T setMaxClients(int maxClients)
A value of zero imposes no restriction.
maxClients
- positive integer, restricting the maximum number of connected clients.java.lang.IllegalArgumentException
- if the maxClients < 0
.public T setInactivityTimeout(int inactivityTimeout)
The timeout must be greater than 0. A timeout of values 0 implies that the option is disabled (i.e., timeout of infinity).
The default value is 0.
inactivityTimeout
- the timeout value.java.lang.IllegalArgumentException
- if the inactivityTimeout < 0
.public T setResponseTimeout(int responseTimeout)
The timeout must be greater than 0. A timeout of values 0 implies that the option is disabled (i.e., timeout of infinity).
The default value is 0.
responseTimeout
- the timeout value.java.lang.IllegalArgumentException
- if the responseTimeout < 0
.public T setConnectionListener(ServerConnectionListener connectionListener)