Gets / Sets IP Address for TCP or SOE transports.
Dotted decimal IP Address (e.g. "192.168.1.45")
| Exception Type | Condition |
|---|---|
| ArgumentNullException | Thrown if IPAddress is a null reference (Nothing in Visual Basic) |
| ArgumentOutOfRangeException | Thrown if IPAddress.Length is less that 6 characters. |
VB Imports MBLink ' ********************* ' * Create Controller Dim MBDevice As new Controller ' ********************** ' * create MODBUS TCP transport class Dim transport as new CommDriver transport.Driver = DRIVERTYPE.TCP transport.IPAddress = "192.168.1.42" transport.Timeout = 1000 ' ************************ ' * assign transport to Controller MBDevice.Transport = transport ' **************************** ' * connect to MODBUS device using tranport MBDevice.Connect() C# using MBLink; ///////////////////////////////// // Create Controller Controller MBDevice = new Controller(); ///////////////////////////////// // create MODBUS TCP transport class // COM1, 19200, N, 8, 1 CommDriver transport = new CommDriver(); transport.Driver = DRIVERTYPE.TCP; transport.IPAddress = "192.168.1.42"; transport.Timeout = 1000; ////////////////////////////// // assign transport to Controller MBDevice.Transport = transport; ////////////////////////////// // connect to MODBUS device using transport MBDevice.Connect();
CommDriver Class | MBLink Namespace