From e7954ad2762e321c030776f4993301eca4369b66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=88=91=E5=8F=AB=E9=94=84=E5=A4=B4?= Date: Wed, 13 Dec 2023 09:55:25 +0800 Subject: [PATCH] 172.18.4.100 --- DataBlockHelper/PlcConnect.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/DataBlockHelper/PlcConnect.cs b/DataBlockHelper/PlcConnect.cs index 85fc4cc..8c10a7d 100644 --- a/DataBlockHelper/PlcConnect.cs +++ b/DataBlockHelper/PlcConnect.cs @@ -27,22 +27,22 @@ namespace DataBlockHelper SiemensPLCS siemensPLCS = SiemensPLCS.S1500; SiemensS7Net s7 = new SiemensS7Net(siemensPLCS); s7.SetPersistentConnection(); - // s7.IpAddress = "172.18.4.100"; + s7.IpAddress = "172.18.4.100"; - s7.IpAddress = "192.168.1.110"; + //s7.IpAddress = "192.168.1.110"; s7.Port = 102; var su = s7.ConnectServer(); if (!su.IsSuccess) { - //s7.IpAddress = "192.168.0.100"; - //s7.Port = 7788; - //var fn = s7.ConnectServer(); - //if (!fn.IsSuccess) - //{ - // return new SiemensS7Net(siemensPLCS); - //} + s7.IpAddress = "192.168.0.100"; + s7.Port = 7788; + var fn = s7.ConnectServer(); + if (!fn.IsSuccess) + { + return new SiemensS7Net(siemensPLCS); + } } return s7;