Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS15 broadcast IP 255.255.255.255 not allowed #11

Open
szafranr opened this issue Sep 23, 2021 · 2 comments
Open

iOS15 broadcast IP 255.255.255.255 not allowed #11

szafranr opened this issue Sep 23, 2021 · 2 comments

Comments

@szafranr
Copy link

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 = ...

@oldrev
Copy link
Owner

oldrev commented Sep 24, 2021

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.

@szafranr
Copy link
Author

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));
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants