Exemplo n.º 1
0
        static void Receive(ISearcher searcher, List <UdpClient> clients)
        {
            IPEndPoint received = new IPEndPoint(IPAddress.Parse("192.168.0.1"), 5351);

            foreach (UdpClient client in clients)
            {
                if (client.Available > 0)
                {
                    IPAddress localAddress = ((IPEndPoint)client.Client.LocalEndPoint).Address;
                    byte[]    data         = client.Receive(ref received);
                    searcher.Handle(localAddress, data, received);
                }
            }
        }
Exemplo n.º 2
0
        static async Task Receive(ISearcher searcher, List <UdpClient> clients)
        {
            foreach (UdpClient client in clients)
            {
                if (client.Available > 0)
                {
                    IPAddress localAddress = ((IPEndPoint)client.Client.LocalEndPoint).Address;
                    var       result       = await client.ReceiveAsync().ConfigureAwait(false);

                    var data     = result.Buffer;
                    var received = result.RemoteEndPoint;
                    searcher.Handle(localAddress, data, received);
                }
            }
        }
Exemplo n.º 3
0
        private static void Receive(ISearcher searcher, List <UdpClient> clients)
        {
            IPEndPoint received = new IPEndPoint(IPAddress.Parse("192.168.8.1"), 5351);

            foreach (UdpClient client in clients)
            {
#if SSHARP
                if (client.DataAvailable)
#else
                if (client.Available > 0)
#endif
                {
#if SSHARP
                    IPAddress localAddress = ((IPEndPoint)client.LocalEndPoint).Address;
#else
                    IPAddress localAddress = ((IPEndPoint)client.Client.LocalEndPoint).Address;
#endif
                    byte[] data = client.Receive(ref received);
                    searcher.Handle(localAddress, data, received);
                }
            }
        }
Exemplo n.º 4
0
		static void Receive (ISearcher searcher, List<UdpClient> clients)
		{
			IPEndPoint received = new IPEndPoint(IPAddress.Parse("192.168.0.1"), 5351);
			foreach (UdpClient client in clients)
			{
				if (client.Available > 0)
				{
				    IPAddress localAddress = ((IPEndPoint)client.Client.LocalEndPoint).Address;
					byte[] data = client.Receive(ref received);
					searcher.Handle(localAddress, data, received);
				}
            }
        }