ExistentialAudio/SwiftOSC

Works on Simulator but not on Device

Opened this issue · 3 comments

Do I need a special entitlement such as multicast to run this successfully in the device?

OSCServer(address: "", port: 5556) is running in the device.

Sender sends to device IP directly and port 5556.
This scenario works in the simulator but not in the actual device.

Thanks a lot for your help.

By checking further, I'm seeing that,

int len=(int)recvfrom(socket_fd, outdata, expted_len, 0, (struct sockaddr *)&cli_addr, &clilen);

in yudpsocket.c blocks on device.

I've changed the socket options a bit to introduce timeouts to at least have a return value by making recvfrom non blocking.

 struct timeval tv;
 tv.tv_sec = 3;
 tv.tv_usec = 750000;
 setsockopt( socketfd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv) );

I'm receiving the return value of -1.

I'm almost sure that it should be related to some apple introduced security layer.

Have you ever tried running a server on the actual device?

Also in this test, to reduce the failure probability I'm going through this route

setsockopt( socketfd, SOL_SOCKET, SO_REUSEADDR, &reuseon, sizeof(reuseon) );

instead of this one,

setsockopt( socketfd, SOL_SOCKET, SO_BROADCAST, &reuseon, sizeof(reuseon) );

And running the server like

OSCServer(address: "127.0.0.1", port: 5556)

If you have time, I'd love if you try again. It would be great help to me. Then I can know if it originates from me or the library.