Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- IPEndPoint ProductEndPoint = new IPEndPoint(IPAddress.Any, 0);
- UdpClient host = new UdpClient();
- host.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
- host.Client.Bind(new IPEndPoint(IPAddress.Parse("192.168.0.1"), 67)); //192.168.0.1 is ip address of PC
- for(int i = 0; i < 30; i++)
- {
- if (host.Available > 0)
- {
- byte[] Data = host.Receive(ref ProductEndPoint);
- // Do something with the data
- }
- else
- Thread.Sleep(1000);
- }
Add Comment
Please, Sign In to add comment