Unable to send unicast messages in ad-hoc mode with new iPad models

Hi, I have this problem. I attach a simple project in order that you can replicate this issue.

The simple project is in this link

Instructions:

  1. Put in ad-hoc mode your Mac, create a network and launch in a shell server_udp.py
  2. Launch socket-test project in a new iPad, for example A2230 (MY2V2TY/A) model with iOS 14.5.1 (or 14.6)
  3. Run in another shell of the Mac ifconfig command and write the ip (something like 169.254. ...) on the Destination IP in the socket-test app in the iPad
  4. Select an interface (for example en0), press Init and then Send. In the console of XCode, iPad prints that it sends 4 bytes, but nothing happens in the server_udp.py (in fact there is a print when it receives something).

If you try the same procedure with old iPad model or in AP mode, everything works fine!

I have also an update: after you follow all the instructions, try to do this:

  1. disassociate Mac from ad-hoc network
  2. riassociate from the list of airport (iPad continues to be in ad-hoc)
  3. Select an interface, press Init and then Send. In the console of XCode, iPad prints that it sends 4 bytes, AND finally in the server_udp.py happens the magic.

Why if I create the ad-hoc network on my Mac first, iPad cannot send packets?

Thanks in advance

Launch socket-test project in a new iPad, for example A2230 (MY2V2TY/A) model with iOS 14.5.1 (or 14.6) iPad prints that it sends 4 bytes, but nothing happens in the server_udp.py (in fact there is a print when it receives something).

It looks like you are wanting to send broadcast packets onto a network:


sockt = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
...
int opt = 1;
int ret = setsockopt(sockt, SOL_SOCKET, SO_BROADCAST, (char *) &opt, sizeof(opt));

Make sure to check the update to the Local Network Privacy FAQ-3 post here. Sending and receiving a UDP Broadcast via BSD sockets now requires the Multicast Entitlement.

Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com

The link is ok now!

Even if I comment that lines, I still have the same problem with unicast data.

Unable to send unicast messages in ad-hoc mode with new iPad models
 
 
Q