1

I'm using GCDAsyncUdpSocket on iOS (successfully) to send and receive data using UDP starting it as follows:

udpSocket = [[GCDAsyncUdpSocket alloc] initWithDelegate: self delegateQueue: dispatch_get_main_queue()];
NSError *error;
BOOL result = [udpSocket bindToPort: 3054 error: &error];

The device sends data back on port 3054, which I see using the delegate call udpSocket:didReceiveData: fromAddress:withFilterContext:. The device also sends information on port 9750, and I would like to see that, too. I've tried not binding to a specific port, but that fails for other reasons. I've also tried starting a separate socket using

udpDataSocket = [[GCDAsyncUdpSocket alloc] initWithDelegate: self delegateQueue: dispatch_get_main_queue()];
NSError *error;
BOOL result = [udpDataSocket bindToPort: 9750 error: &error];

While these calls succeed with no error, I don't get the data from port 9750.

I do know for sure that the data is being sent; this is an issue on the iOS side. I know this because:

  1. A logic analyzer sees the data arrive at the device for transmission on port 9750; this is suggestive but not conclusive.

  2. I can switch the port the device uses to send the second data stream to 3054, in which case my app sees the data. This is undesirable, though.

So, how does one read data from two UDP ports front he same IP address on iOS using GCDAsyncUdpSocket?

Mike
  • 481
  • 10
  • 24
Mike
  • 3,084
  • 1
  • 25
  • 44

0 Answers0