| | |
| | | this.ModbusTcpNetClient.Port = Port; |
| | | this.ModbusTcpNetClient.DataFormat = HslCommunication.Core.DataFormat.CDAB; ; |
| | | this.ModbusTcpNetClient.AddressStartWithZero = true; |
| | | this.ModbusTcpNetClient.ConnectTimeOut = 100; |
| | | this.ModbusTcpNetClient.ConnectTimeOut = 2000; |
| | | this.ModbusTcpNetClient.ReceiveTimeOut = 2000; |
| | | this.ModbusTcpNetClient.IsCheckMessageId = true; |
| | | this.ModbusTcpNetClient.IsStringReverse = false; |
| | | this.ModbusTcpNetClient.Station = 2; |
| | |
| | | |
| | | if (!result.IsSuccess) |
| | | { |
| | | WIDESEA_Common.Tools.WriteLog.GetLog().Write($"Error:{PLCName}连接失败, {DateTime.Now}{Environment.NewLine}错误信息:{result.Message}", PLCName); |
| | | WIDESEA_Common.Tools.WriteLog.GetLog().Write($"Error:{PLCName}连接失败---{DateTime.Now}{Environment.NewLine}错误信息:{result.Message}", PLCName); |
| | | IsConnected = false; |
| | | return $"连接失败,错误信息:{result.Message}"; |
| | | } |
| | |
| | | { |
| | | IsConnected = true; |
| | | |
| | | WIDESEA_Common.Tools.WriteLog.GetLog().Write($"Info:{PLCName}连接成功!, {DateTime.Now}", PLCName); |
| | | WIDESEA_Common.Tools.WriteLog.GetLog().Write($"Info:{PLCName}连接成功!---{DateTime.Now}", PLCName); |
| | | return $"连接成功"; |
| | | } |
| | | |