Example #1
0
 public Receiver(int multicastPort, string localNetworkAdapter, string multicastIP)
     : base(multicastPort, localNetworkAdapter, multicastIP)
 {
     if (_ActiveListeners.Contains(LocalNetworkAdapter.ToUpper(System.Globalization.CultureInfo.CurrentCulture) + ":" + MulticastIP + ":" + MulticastPort.ToString(System.Globalization.CultureInfo.CurrentCulture)))
     {
         return;
     }
 }
Example #2
0
        public Sender(int multicastPort, string localNetworkAdapter, string multicastIP, int msDelayBetweenPackets, int packetsPerDelayWindow)
            : base(multicastPort, localNetworkAdapter, multicastIP)
        {
            lock (_ActiveSenders)
            {
                _SenderKey = LocalNetworkAdapter.Trim().ToUpper(System.Globalization.CultureInfo.CurrentCulture) + ":" + MulticastIP + ":" + MulticastPort;

                if (!_ActiveSenders.ContainsKey(_SenderKey))
                {
                    _Active = true;

                    if (msDelayBetweenPackets < 0)
                    {
                        msDelayBetweenPackets = 0;
                    }

                    _MSDelay = msDelayBetweenPackets;

                    if (packetsPerDelayWindow < 0)
                    {
                        packetsPerDelayWindow = 0;
                    }

                    _PacketsPerDelay = packetsPerDelayWindow;

                    _ActiveSenders[_SenderKey] = this;

                    if (!_SerialLocks.ContainsKey(LocalNetworkAdapter.Trim().ToUpper(System.Globalization.CultureInfo.CurrentCulture)))
                    {
                        _SerialLocks[LocalNetworkAdapter.Trim().ToUpper(System.Globalization.CultureInfo.CurrentCulture)] = new object();
                    }

                    _SendMutex = _SerialLocks[LocalNetworkAdapter.Trim().ToUpper(System.Globalization.CultureInfo.CurrentCulture)];

                    _References++;
                }
            }
        }