public void StartReception(int port) { udpClient = new UdpClient(port); this.portNumber.Text = ""+port; //IPEndPoint object will allow us to read datagrams sent from any source. IPEndPoint RemoteIpEndPoint = new IPEndPoint(IPAddress.Any, 0); Console.WriteLine("Receiving UDP packets on port " + port); UdpState s = new UdpState(); s.e = RemoteIpEndPoint; s.u = udpClient; udpClient.BeginReceive(new AsyncCallback(this.UDPPacketReceivedCallback), s); }
public void StartReception(int port) { udpClient = new UdpClient(port); this.portNumber.Text = "" + port; //IPEndPoint object will allow us to read datagrams sent from any source. IPEndPoint RemoteIpEndPoint = new IPEndPoint(IPAddress.Any, 0); Console.WriteLine("Receiving UDP packets on port " + port); UdpState s = new UdpState(); s.e = RemoteIpEndPoint; s.u = udpClient; udpClient.BeginReceive(new AsyncCallback(this.UDPPacketReceivedCallback), s); }