SwiftOSC icon indicating copy to clipboard operation
SwiftOSC copied to clipboard

Works on Simulator but not on Device

Open alisomay opened this issue 3 years ago • 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.

alisomay avatar Feb 16 '22 13:02 alisomay

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)

alisomay avatar Feb 16 '22 15:02 alisomay

Have you ever tried running a server on the actual device? Of course. Could be recent updates changed stuff. On Feb 16, 2022, 7:04 AM -0800, Ali Somay @.*>, wrote: 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. 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? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.>

devinroth avatar Feb 16 '22 17:02 devinroth

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.

alisomay avatar Feb 16 '22 17:02 alisomay