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

OscClient broadcast fails on IOS. #39

Open
zacksettel opened this issue Nov 29, 2022 · 0 comments
Open

OscClient broadcast fails on IOS. #39

zacksettel opened this issue Nov 29, 2022 · 0 comments
Assignees
Labels

Comments

@zacksettel
Copy link

zacksettel commented Nov 29, 2022

OscClient enables broadcast only for one address: "255.255.255.255", and this address fails on my IOS device. Broadcast is enabled but the network but broadcasting is not permitted.

If OscClient enabled broadcast for any address of the form "xxx.xxx.xxx.255" then broadcast over the a local network (eg. "192.168.0.255" ) will likely be permitted, which is the case on nearly the local networks I have used. Since I use local broadcast quite often, not having that option for my IOS builds is a bummer.

Proposed solution:

I modified and tested the following code, which worked on my desktop and IOS builds.

    public OscClient(string destination, int port)
    {
        _socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);

        if ( String.Equals(destination.Substring(destination.Length-3),  "255"))
        //if (destination == "192.168.0.255")
            _socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, true);

        var dest = new IPEndPoint(IPAddress.Parse(destination), port);
        _socket.Connect(dest);
    }

Hopefully this makes sense and is a resonable request.

@keijiro keijiro self-assigned this Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants