Пример #1
0
        public UDPListener(string _ID, string _ip, int _port, string _netcard = "")
        {
            ID          = _ID;
            networkIp   = _ip;
            networkPort = _port;
            isMulticast = HelperTools.IsMulticast(_ip, out IPAddress ipAdrr);
            netcard     = _netcard;

            string[] chunks = _ip.Split('.');
            if (chunks.Length == 4)
            {
                for (int i = 0; i < 4; i++)
                {
                    ipChunks[i] = ushort.Parse(chunks[i]);
                }
            }
        }
Пример #2
0
        public UDPSender(string _id, string _ip, int _port, bool onlyLocal, string _netcard = "")
        {
            ID          = _id;
            networkIp   = _ip;
            networkPort = _port;
            isMulticast = HelperTools.IsMulticast(_ip, out IPAddress ipAdrr);
            netcard     = _netcard;

            if (onlyLocal)
            {
                ttl = 0;
            }
            else
            {
                ttl = 255;
            }

            dataRateTimer = new Timer(OnDataRate, null, 1000, 1000);
        }