public void TestPlcConnect() { using (var plc = new MacHalPlcContext()) { plc.Connect("192.168.0.200", 2); plc.StartAsyn(); if (!SpinWait.SpinUntil(() => plc.IsConnectedByHandShake, 60 * 1000)) { throw new MvaException("PLC connection fail"); } Console.WriteLine("PLC connection success"); //while (true) System.Threading.Thread.Sleep(1000); } }