Hi all, coding C# in VS.NET 2005
I'm using the following code.
-----
// Receive a message and write it to the console.
UdpClient u = new UdpClient(m_ipEndPoint);
UdpState s = new UdpState();
s.e = m_ipEndPoint;
s.u = u;
u.BeginReceive(new AsyncCallback(ReceiveCallback), s);
while (!messageReceived)
Thread.Sleep(100);
s.u.Close();
-----
The code executes fine the first time, the callback is handled properly. My problem is that s.u.Close() does not release the port, so the next time this code executes "UdpClient u = new UdpClient(m_ipEndPoint);" it throws an exception saying the port is already in use.