Thanks to visit codestin.com
Credit goes to github.com

Skip to content

OscClient broadcast fails on IOS. #39

@zacksettel

Description

@zacksettel

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.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions