public Client() { Client.Instance = this; ClientId = new System.Random().Next().ToString("X"); Handle = Environment.UserName; udpClient = new UdpClient(); udpClient.JoinMulticastGroup(IPAddress.Parse(MULTICAST_ADDR)); udpClient.MulticastLoopback = true; udpState = new UDPState(); listen(); }
private void listen() { IPEndPoint e = new IPEndPoint(IPAddress.Any, PORT); udpListener = new UdpClient(e); udpState = new UDPState(); udpState.Endpoint = e; udpState.UdpClient = udpListener; udpListener.JoinMulticastGroup(IPAddress.Parse(MULTICAST_ADDR)); udpListener.Ttl = 1; udpListener.BeginReceive(new AsyncCallback(ReceiveCallback), udpState); }