public final class TcpServer extends Object
To add outstations to it, use addOutstation(io.stepfunc.dnp3.OutstationConfig, io.stepfunc.dnp3.EventBufferConfig, io.stepfunc.dnp3.OutstationApplication, io.stepfunc.dnp3.OutstationInformation, io.stepfunc.dnp3.ControlHandler, io.stepfunc.dnp3.ConnectionStateListener, io.stepfunc.dnp3.AddressFilter)
. Once all the outstations are added, the server can be started with bind()
.
shutdown()
is used to gracefully shutdown all the outstations and the server.
Constructor and Description |
---|
TcpServer(Runtime runtime,
LinkErrorMode linkErrorMode,
String address)
Create a new TCP server.
|
Modifier and Type | Method and Description |
---|---|
Outstation |
addOutstation(OutstationConfig config,
EventBufferConfig eventConfig,
OutstationApplication application,
OutstationInformation information,
ControlHandler controlHandler,
ConnectionStateListener listener,
AddressFilter filter)
Add an outstation to the server.
|
void |
bind()
Bind the server to the port and starts listening.
|
void |
finalize() |
void |
shutdown()
Gracefully shutdown all the outstations associated to this server, stops the server and release resources.
|
public TcpServer(Runtime runtime, LinkErrorMode linkErrorMode, String address)
To start it, use bind()
.
runtime
- Runtime to execute the server onlinkErrorMode
- Controls how link errors are handled with respect to the TCP sessionaddress
- Address to bind the server to e.g. 127.0.0.1:20000ParamException
- ParamErrorpublic void shutdown()
public Outstation addOutstation(OutstationConfig config, EventBufferConfig eventConfig, OutstationApplication application, OutstationInformation information, ControlHandler controlHandler, ConnectionStateListener listener, AddressFilter filter)
The returned Outstation
can be used to modify points of the outstation.
In order for the outstation to run, the TCP server must be running. Use bind()
to run it.
config
- Outstation configurationeventConfig
- Event buffer configurationapplication
- Outstation application callbacksinformation
- Outstation information callbackscontrolHandler
- Outstation control handlerlistener
- Listener for the connection statefilter
- Address filterParamException
- ParamErrorpublic void bind()
ParamException
- ParamErrorCopyright © 2021. All rights reserved.