sandwych-smartconfig
sandwych-smartconfig copied to clipboard
iOS15 broadcast IP 255.255.255.255 not allowed
trafficstars
Hi,
Could you provide change in this library? 255.255.255.255 broadcast address is ignored by iOS15
probably DatagramBroadcaster.cs method BroadcastAsync line with _broadcastTarget = ...
Thanks for the bug report!
Sorry I didn't test this library on iOS.
Since SmartConfig protocol is all about the length of wireless packet, the broadcast address is not really important. Even if it's just a P2P data sending will do the trick.
I'll fix this problem ASAP.
you can calculate broadcast IPAddress based on IP and mask provided
public static IPAddress GetBroadcastAddress(IPAddress address, IPAddress mask)
{
uint ipAddress = BitConverter.ToUInt32(address.GetAddressBytes(), 0);
uint ipMaskV4 = BitConverter.ToUInt32(mask.GetAddressBytes(), 0);
uint broadCastIpAddress = ipAddress | ~ipMaskV4;
return new IPAddress(BitConverter.GetBytes(broadCastIpAddress));
}