I am developing an application in which broadcasting is essential. I have created two projects Client and server. I am able to send broadcast message but I am not receiving in server project. My code is as follows
Server:
private DatagramSocket _udpSocket = new DatagramSocket();
private async void Button_Click_1(object sender, RoutedEventArgs e)
{
_udpSocket.MessageReceived += _udpSocket_MessageReceived;
await _udpSocket.BindServiceNameAsync("4777");
}
void _udpSocket_MessageReceived(DatagramSocket sender, DatagramSocketMessageReceivedEventArgs args)
{
}
Client
HostName h = new HostName("255.255.255.255");
IOutputStream outStream = await _socket.GetOutputStreamAsync(h, "4777");
DataWriter de = new DataWriter(outStream);
de.WriteByte(new byte());
await de.StoreAsync();
de.DetachBuffer();
But If on client side I replace 255.255.255.255 with local IPAddress, I can receive the message on the server.
What is the problem?