程序调试中当程序运行到:
string ipAddress = “10.0.0.69”; //use TCP for example
int tcpPort = 502;
TcpClient tcpClient = new TcpClient();
ModbusIpMaster IpMaster = ModbusIpMaster.CreateIp(tcpClient);
IpMaster= ModbusIpMaster.CreateIp(tcpClient);
IpMaster.Transport.Retries = 0; //don't have to do retries
IpMaster.Transport.ReadTimeout = com1.Com_ReadTimeOut;
此时会产生错误提示:不允许对非连接的套接字执行此操作。
产生原因:以太网链路有问题:ping不上对应的IP地址。