Example #1
0
        public void connect(CpsNet _cpsNet)
        {
            reconnect_counter++;
            cpsNet       = _cpsNet;
            DicSensorVal = new Dictionary <short, float>();

            if (client_udp != null)
            {
                if (client_udp.RemoteIp != _ip)
                {
                    client_udp.RemoteIp = _ip;
                }
                if (client_udp.RemotePort != _port)
                {
                    client_udp.RemotePort = _port;
                }
            }
            else
            {
                client_udp = cpsNet.newClient(_ip, _port.ToString());
            }

            Frame f = new Frame(client_udp);

            f.SetHeaderFlag(FrameHeaderFlag.SYNC);
            send(f);
            //initRequestTimer();

            //SendMsg = new Thread(new ThreadStart(initRequestTimer));
            //SendMsg.IsBackground = true;

            //SendMsg.Start();
        }
Example #2
0
 //Thread SendMsg;
 #region construktor / init / connect
 public plc(string ip, int port, string plc_name = "not named")
 {
     _ip          = ip;
     _port        = port;
     _PLC_Name    = plc_name;
     client_udp   = new Client(_ip, port.ToString());
     ListAktuator = new List <aktuator>();
 }