dnp3 (.NET API) 1.8.0-RC1
Loading...
Searching...
No Matches
dnp3.ConnectionInfo Class Reference

Builder for configuring connection parameters More...

Public Member Functions

 ConnectionInfo ()
 Create a new ConnectionInfo. You must call set_endpoint() before using it. More...
 
ParamError SetEndpoint (string endpoint)
 Set the endpoint to connect to More...
 
void SetTimeout (TimeSpan timeoutMs)
 Set the connection timeout More...
 
void ClearTimeout ()
 Clear any previously configured timeout so the OS default is used More...
 
ParamError SetLocalEndpoint (string localEndpoint)
 Set the local endpoint to bind to More...
 
void ClearLocalEndpoint ()
 Clear any previously configured local endpoint so the OS chooses the interface and port More...
 
ParamError SetMasterAddress (ushort address)
 Change the master address for this and all subsequent connections More...
 

Detailed Description

Builder for configuring connection parameters

Instances are passed to NextEndpointAction.ConnectTo inside IClientConnectionHandler.Next.

You may construct a new instance for each callback to IClientConnectionHandler.Next or reuse a single instance to reduce allocations.

When reusing, call ConnectionInfo.ClearTimeout or ConnectionInfo.ClearLocalEndpoint before setting new values if you need to revert to the default timeout or adapter selection.

Constructor & Destructor Documentation

◆ ConnectionInfo()

dnp3.ConnectionInfo.ConnectionInfo ( )
inline

Create a new ConnectionInfo. You must call set_endpoint() before using it.

Member Function Documentation

◆ ClearLocalEndpoint()

void dnp3.ConnectionInfo.ClearLocalEndpoint ( )
inline

Clear any previously configured local endpoint so the OS chooses the interface and port

◆ ClearTimeout()

void dnp3.ConnectionInfo.ClearTimeout ( )
inline

Clear any previously configured timeout so the OS default is used

◆ SetEndpoint()

ParamError dnp3.ConnectionInfo.SetEndpoint ( string  endpoint)
inline

Set the endpoint to connect to

This method must be called before passing the ConnectionInfo to connect_to()

Parameters
endpointEndpoint to connect to (hostname or IP:port)
Returns
Error status - Ok if successful

◆ SetLocalEndpoint()

ParamError dnp3.ConnectionInfo.SetLocalEndpoint ( string  localEndpoint)
inline

Set the local endpoint to bind to

Optional: If not called, the OS will select the network adapter based on the routing table for the destination address, and assign an ephemeral port.

This is primarily useful for enforcing network segmentation in multi-homed systems, such as OT gateways that bridge device and enterprise networks. By explicitly binding to a specific adapter, you ensure traffic goes out the correct interface regardless of routing table configuration.

Typically you should specify port 0 to let the OS assign an ephemeral port while forcing a specific network adapter. Using a specific non-zero port is rarely needed for client connections and may cause bind failures if the port is already in use.

Parameters
localEndpointLocal address to bind to
Returns
Error status - Ok if successful

◆ SetMasterAddress()

ParamError dnp3.ConnectionInfo.SetMasterAddress ( ushort  address)
inline

Change the master address for this and all subsequent connections

Optional: The master address change is persistent and remains active across reconnections until explicitly changed again.

This is useful when an outstation needs to communicate with different masters at different endpoints, such as during failover scenarios or when connecting to a backup master.

If not called, the outstation uses the master address specified in its configuration.

Parameters
addressMaster link-layer address
Returns
Error status - Ok if successful

◆ SetTimeout()

void dnp3.ConnectionInfo.SetTimeout ( TimeSpan  timeoutMs)
inline

Set the connection timeout

Optional: If not called, the operating system's default timeout will be used

Parameters
timeoutMsConnection timeout

The documentation for this class was generated from the following file: