/// <summary> /// 开始监听 /// </summary> public void Start() { isStop = false; myEventLog.LogInfo($"开始监听"); task = Task.Run(() => { while (isStop == false) { plcUtils.SendData(data); Thread.Sleep(Frequent); } myEventLog.LogInfo($"停止监听"); }); }
public void SendData(string data) { myEventLog.LogInfo($"PLC发送数据:{data},{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ffff")}"); plcUtils.SendData(data); }