Class TCPConnection
A TCP/IP connection to a Brainboxes device over Ethernet. This is the most common connection type for both ED-series (Remote IO) and ES-series (Ethernet to Serial) devices.
Assembly: Brainboxes.IO.dll
View Source
public class TCPConnection : Connection, IConnection, IDisposable
Inheritance: System.Object -> Brainboxes.IO.Connection
Implements:
Brainboxes.IO.IConnection, System.IDisposable
Properties
Port
The TCP port of the Connection to the Brainboxes Device e.g. "9500"
View Source
public int Port { get; set; }
ConnectionTimeout
Connection timeout for the socket in milliseconds, default 20 seconds This is approximately the same as the TCPClient connection timeout, however unlike the TCPClient, this connection timeout can be altered
View Source
public int ConnectionTimeout { get; set; }
Timeout
The connection and stream timeouts (for both stream read and stream write), measured in millseconds
View Source
public override int Timeout { get; set; }
Fields
DEFAULT_ASCII_PORT
The default port for ASCII
View Source
public static readonly int DEFAULT_ASCII_PORT
DEFAULT_MODBUSTCP_PORT
The default port for Modbus TCP
View Source
public static readonly int DEFAULT_MODBUSTCP_PORT
IP
The IP address of the Connection to the Brainboxes Device e.g. "192.168.0.1"
View Source
public readonly string IP
_port
The TCP port of the connection to the Brainboxes Device
View Source
protected int _port
Methods
_computeIsConnectedValue()
Computes whether the socket is connected by making a nonblocking, zero-byte Send call. This method has no side effects - it just returns the computed state.
View Source
protected override bool _computeIsConnectedValue()
Returns
System.Boolean
_newValueIsConnected()
Updates IsConnected and handles socket cleanup on errors. Called by polling to refresh the cache.
View Source
protected override void _newValueIsConnected()
_computeIsAvailableValue()
Computes whether the device is available by sending a ping. This method has no side effects - it just returns the computed state.
View Source
protected override bool _computeIsAvailableValue()
Returns
System.Boolean
_newValueIsAvailable()
sends a ping to the device and determines if it is still available on the network
View Source
protected override void _newValueIsAvailable()
ToString()
ToString
View Source
public override string ToString()
Returns
System.String
_connect()
Connect to the Brainboxes Device on the specified IP address and port, within the ConnectionTimeout
View Source
protected override void _connect()
_disconnect()
close this connection to the Brainboxes Device
View Source
protected override void _disconnect()
Implements
- Brainboxes.IO.IConnection
System.IDisposable