0

I am trying to send and receive TCP streams from an iPad via a wireless connection to a laptop. I create sockets with boost::asio. This project is a port of a data streaming library that I maintain that works quite well on Windows, OSX, and Linux.

I can get the app to send and receive streams to/from other computers on a wired LAN when I run it on the simulator. But, when I target the device itself, I can't see any streams.

As I say, I am communicating via wireless between an iPad and a laptop. I create a wireless network on the laptop and then give the iPad a static IP. The connection appears to be fine, because I can ping the iPad with no packet loss. I have also tried connecting the devices by putting them on the same wireless LAN (although I'm not supposed to use wireless routers at work) and this also does not work.

According to apple, setting up streams like this with NSStream will just work. Maybe there is some permissions magic happening under the hood that I am not doing with my calls to boost::asio functions. In any case, I can't see the streams.

dmedine
  • 1,430
  • 8
  • 25
  • No magic should be required on the iOS side. Are you sure something like a firewall on the laptop isn't blocking your connection? What result do you get when you try to open the stream? Timeout? Can run you run Wireshark on the laptop to see if a connection is even being attempted? – Paulw11 Apr 24 '15 at 01:02
  • Thanks. There is certainly no firewall. When I open an lsl (lsl is the name of my library) stream on the iPad, I am not able to see it amongst the list of streams of lsl streams available to laptop. There is a little action on the network (according to wireshark) when I open or close the stream, but nothing while the stream is running. – dmedine Apr 27 '15 at 21:33
  • If you don't get a timeout or other error establishing the connection and wire shark shows the SYN-SYNACK-ACK packets then I would suggest that you aren't actually sending any data – Paulw11 Apr 27 '15 at 22:30
  • Thanks for leaving another comment so quickly! When I turn the stream on my iPad on, I get a couple of IGMPv2 packets that come out of it: 'Membership Report group 224.0.0.183' and 'Membership Report group 239.255.172.215'. It appears that my iPad wants to send to some multicast group and that packets aren't going to make it all the way to the laptop, and vice versa. I'm not sure how to overcome this. – dmedine Apr 28 '15 at 00:32
  • Does your product use multicast? – Paulw11 Apr 28 '15 at 00:33
  • But there is no SYM-SYMACK-ACK. This has to be an issue with multicasting in and out of the iOS device, because as I mention, everything works fine on a simulator with a wired connection. Apple should account for this scenario in the simulator, but maybe this is not possible. – dmedine Apr 28 '15 at 00:37
  • Yes, there is multicast. I don't know anything about multicast (unfortunately). – dmedine Apr 28 '15 at 00:39
  • Ok, so if it is multicast then it will be UDP, not TCP. This may be applicable - http://stackoverflow.com/questions/24393371/ios-devices-not-receiving-udp-multicast-using-gdasyncudpsocket – Paulw11 Apr 28 '15 at 00:59
  • and maybe this - http://stackoverflow.com/questions/18138272/gcdasyncudpsocket-and-multicast-sending-and-receiving Note that these are using GCDAsyncUdpSocket - you haven't shown the code you are using so there will probably be some different calls required depending on how you are creating the UDP socket – Paulw11 Apr 28 '15 at 01:01
  • hmm. I looked at the Boost website and it doesn't say anything about multicast, so perhaps those packets are unrelated to your app. – Paulw11 Apr 28 '15 at 01:02
  • Perhaps this will help - http://stackoverflow.com/questions/14036311/official-boost-library-support-for-android-and-ios – Paulw11 Apr 28 '15 at 01:04
  • @Paulw11, Thanks again for all your help! I'm on the right track now. I'll come back and answer the question once I get it working properly. – dmedine Apr 28 '15 at 17:02

1 Answers1

1

Actually, it turns out the only thing that was wrong was that I needed to set up my routing table so that it pointed multicast to the wireless card:

> sudo route -nv add -net 224.0.0.183 -interface en1

I got the IP from inspecting packets in wireshark -- it is the address that my device is multicasting to in my laptop. Sending works (from device to laptop), receiving is still silent though. This may be something else that needs to be set int the routing table (I really don't understand much at all about multicasting) or else I can fiddle with some config settings with my library.

dmedine
  • 1,430
  • 8
  • 25
  • I should mention that the library will automatically choose TCP or UDP depending on what is appropriate. – dmedine Apr 28 '15 at 19:01