Hello everyone,
on my local network, there is a udp broadcast sent by a server every 5 seconds. It is 120 Byte long.I am trying to set a socket in order to consume it:
on my local network, there is a udp broadcast sent by a server every 5 seconds. It is 120 Byte long.I am trying to set a socket in order to consume it:
C#:
IPAddress ip = IPAddress.Parse("192.168.127.162");
IPEndPoint ipe = new IPEndPoint(ip, 55555);
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp)
{
ReceiveBufferSize = 120
};
socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, 30);
socket.Bind(ipe);
My local cmd -> /ipconfig shows the following:
Unfortunately, I am getting error message in the binding line:
What could be the problem? Wrong IP format? Or am I doing something wrong when instantiating?
Would be really happy if someone could help me anyhow.
Best regards
Unfortunately, I am getting error message in the binding line:
System.Net.Sockets.SocketException: The requested address is not valid in this context
What could be the problem? Wrong IP format? Or am I doing something wrong when instantiating?
Would be really happy if someone could help me anyhow.
Best regards
Last edited: