Ejemplo n.º 1
0
        public UlTemi2500Tcp(string ip, int port)
        {
            this.ip   = ip;
            this.port = port;

            logging = ETemiLogging.Event;

            logger        = new UlLogger();
            logger.Active = true;
            logger.Path   = "";
            logger.FName  = "Temi2500Log";

            logger.Clear();
            logger.AddTag("CONNECT");
            logger.AddTag("DISCONNECT");
            logger.AddTag("PC->PLC");
            logger.AddTag("PC<-PLC");
            logger.AddTag("COMMENT");
            logger.AddTag("EXCEPTION");

            connected = false;
            client    = new TcpClient();

            stopWatch    = new Stopwatch();
            criticalLock = new object();
        }
Ejemplo n.º 2
0
        //----------------------------------------------------------------------
        public UlMelsecQClient(
            string aIP,
            int aPort,
            EUlProtocol aProtocol = EUlProtocol.Tcp,
            int aPortCount        = csPortCount,
            int aPacketSize       = csPacketSize)
        {
            ip         = aIP;
            port       = aPort;
            protocol   = aProtocol;
            portCount  = aPortCount;
            packetSize = aPacketSize;

            index     = 0;
            connected = false;

            SendingEvent   = null;
            ReceivingEvent = null;

            network = 0x00;
            plc     = 0xFF;
            station = 0x00;

            rand      = new Random();
            stopWatch = new Stopwatch();

            logging       = EMQLog.Event;
            logger        = new UlLogger();
            logger.Active = true;
            logger.Path   = "";
            logger.FName  = "MelsecQLog";

            logger.Clear();
            logger.AddTag("CONNECT");
            logger.AddTag("DISCONNECT");
            logger.AddTag("PC->PLC");
            logger.AddTag("PC<-PLC");
            logger.AddTag("COMMENT");
            logger.AddTag("EXCEPTION");

            if (protocol == EUlProtocol.Tcp)
            {
                tcpList = new List <TcpClient>();

                for (int i = 0; i < portCount; i++)
                {
                    tcpList.Add(new TcpClient());
                }
            }
            else
            {
                udp = new UdpClient();
            }

            // 송수신 Packet 생성
            sPacket = new UlQnA4ESendPacket(packetSize);
            rPacket = new UlQnA4ERecvPacket(packetSize);
        }
Ejemplo n.º 3
0
        public UlEthernetClient(
            string name, int scanTime, EEthernetProtocol protocol, int timeout)
        {
            InvalidFloatValue = float.NaN;
            ScanTime          = scanTime;
            Protocol          = protocol;
            Timeout           = timeout;
            Name = name;

            Mode = EEthernetMode.Real;

            rand = new Random();

            stopWatch = new Stopwatch();

            CreateClient();

            if (ScanTime > 0)
            {
                scaner = new UlEthernetScanerThread(this, ScanTime);
            }
            else
            {
                scaner = null;
            }

            Logging = EEthernetLogging.None;

            logger        = new UlLogger();
            logger.Active = true;
            logger.Path   = "";
            logger.FName  = "EthernetClientLog";

            logger.Clear();
            logger.AddTag("CONNECT");
            logger.AddTag("DISCONNECT");
            logger.AddTag("PC->Device");
            logger.AddTag("PC<-Device");
            logger.AddTag("NOTE");
            logger.AddTag("EXCEPTION");
        }