Socket newsock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); IPEndPoint iep = new IPEndPoint(IPAddress.Any, 11000); newsock.Bind(iep); EndPoint ep = (EndPoint)iep; byte[] datip = new byte[1024]; recv = newsock.ReceiveFrom(datip, ref ep); string stringData = Encoding.ASCII.GetString(datip, 0, recv); IP_Address.Text = ep.ToString(); Application.DoEvents(); IPEndPoint dsender = new IPEndPoint(IPAddress.Parse(IP_Address.Text), 11000); //IP address of device. Waits for connection. EndPoint tmpRemote = (EndPoint)dsender; //stores device into variable
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)