|
|
|
@ -28,7 +28,6 @@ public static class ClientMgr
|
|
|
|
|
|
|
|
|
|
private static void ConnClient()
|
|
|
|
|
{
|
|
|
|
|
int readTimeout = 5, writeTimeout=5, allTimeout=5;
|
|
|
|
|
EquipNetInfo netInfo = new EquipNetInfo()
|
|
|
|
|
{
|
|
|
|
|
//NetAddr = "192.168.3.246",
|
|
|
|
@ -41,6 +40,7 @@ public static class ClientMgr
|
|
|
|
|
Log.Info($"begin to connect {netInfo.Code} {netInfo.NetAddr}:{netInfo.NetPort}");
|
|
|
|
|
|
|
|
|
|
PlcClient = AppInfo.Container.Resolve<PlcClient>();
|
|
|
|
|
Log.Info($"plc client Id={PlcClient.GetHashCode()}");
|
|
|
|
|
|
|
|
|
|
PlcClient.AutoReconnect = true;
|
|
|
|
|
PlcClient.Sn = PlcConst.ChargeEqpCode;
|
|
|
|
@ -51,7 +51,7 @@ public static class ClientMgr
|
|
|
|
|
// client.SendAuth();
|
|
|
|
|
};
|
|
|
|
|
//ip
|
|
|
|
|
PlcClient.InitBootstrap(netInfo.NetAddr, int.Parse(netInfo.NetPort), readTimeout);
|
|
|
|
|
PlcClient.InitBootstrap(netInfo.NetAddr, int.Parse(netInfo.NetPort), 30, 30, 30);
|
|
|
|
|
|
|
|
|
|
/*Task.Run(() =>
|
|
|
|
|
{*/
|
|
|
|
@ -67,7 +67,5 @@ public static class ClientMgr
|
|
|
|
|
Log.Error($"conn plc error ={ex.StackTrace}");
|
|
|
|
|
}
|
|
|
|
|
//});
|
|
|
|
|
|
|
|
|
|
Log.Info($"begin to connect {netInfo.Code} {netInfo.NetAddr}:{netInfo.NetPort}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|