点击或拖拽改变大小

NetworkUdpBaseIpAddress 属性

获取或是设置远程服务器的IP地址,如果是本机测试,那么需要设置为127.0.0.1
Get or set the IP address of the remote server. If it is a local test, then it needs to be set to 127.0.0.1

命名空间:  HslCommunication.Core.Net
程序集:  HslCommunication (在 HslCommunication.dll 中) 版本:11.8.2.0 (11.8.2.0)
语法
public virtual string IpAddress { get; set; }

属性值

类型:String
备注
最好实在初始化的时候进行指定,当使用短连接的时候,支持动态更改,切换;当使用长连接后,无法动态更改
支持使用域名的网址方式,例如:www.hslcommunication.cn
示例
以下举例modbus-tcp的短连接及动态更改ip地址的示例
IpAddress示例
ModbusTcpNet modbus = new ModbusTcpNet( "192.168.0.100" );
// 读取线圈100的值
bool coil_ip100 = modbus.ReadCoil( "100" ).Content;
// 切换ip地址
modbus.IpAddress = "192.168.0.101";
bool coil_ip101 = modbus.ReadCoil( "100" ).Content;
参见