在C#中,我正在使用UdpClient.Receive函数:
public void StartUdpListener(Object state)
{
try
{
udpServer = new UdpClient(new IPEndPoint(IPAddress.Broadcast, 1234));
}
catch (SocketException ex)
{
MessageBox.Show(ex.ErrorCode.ToString());
}
IPEndPoint remoteEndPoint = null;
receivedNotification=udpServer.Receive(ref remoteEndPoint);
...
然而,我遇到了一个套接字异常,错误代码为10049,显示地址不可用。我该怎么做才能消除这个异常呢?