How do you get host's broadcast address of the default network adapter? C#
问题 Let's say that I want to send an udp message to every host in my subnet (and then receive an udp message from any host in my subnet): at the moment I do: IPAddress broadcast = IPAddress.Parse("192.168.1.255"); but of course I want this to be done dinamically in the event that the subnet is different from 192.168.1/24. I've tried with: IPAddress broadcast = IPAddress.Broadcast; but IPAddress.Broadcast represents "255.255.255.255" which can't be used to send messages (it throws an exception)..