public IPPort(ModbusConnection con) : base(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp) { _con = con; if (con.TimeOut != 0) { TimeOut = con.TimeOut; } base.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, TimeOut); }
void IDevice.Register(ModbusConnection con) { _con = con; switch (con.ComType) { case ComType.SerialPort: _iProtocol = new ModbusRTU(); break; case ComType.IPPort: _iProtocol = new ModbusTCP(); break; } }