I create a socket and bind it to a unicast address. However, it reads packets sent to the broadcast address and I do not understand why.
IPAddress ip;
IPAddress.TryParse("X.X.X.99", out ip);
Socket receiver = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
receiver.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
receiver.Bind(new IPEndPoint(ip, 9999));
byte rcvBuffer = new byte[1500];
int bytesRead = receiver.Receive(rcvBuffer);
With this code I receive packets addressed to both "x.x.x.255:9999" and "x.x.x.99:9999" and do not understand why. Anyone know why?