public void Reset(ServerInfo ser) { try { if (client != null && client.Connected) { client.Close(); } if (master != null) { master.Dispose(); } StopGetData(); client = new TcpClient(ser.server_Ip, int.Parse(ser.server_Port)); master = ModbusIpMaster.CreateIp(client); Status = 0; } catch (Exception ex) { Status = -1; } }
public void DeviceClear() { ErrorConnTimer.Enabled = false; GetDataConnTimer.Enabled = false; master.Dispose(); ErrorConnCount = 0; Status = Constant.DeviceNoConnection; }