Hi all,
For this application I need to connect to a "Tibbo" (more information here:
http://tibbo.com/).
When I send a broadcast "X", all Tibbo's will respond with the IP address/port they are reachable on.
So to start my project, I first send a broadcast "X" like this:
NSString *bcHost = @"255.255.255.255";
NSString *anyHost = @"0.0.0.0";
int UDP_SOCKET_PORT = 65535;
int DISCOVERY_PORT = 6003;
udpSocket = [[AsyncUdpSocket alloc] initWithDelegate:self];
[udpSocket bindToAddress:anyHost port:DISCOVERY_PORT error:nil];
[udpSocket enableBroadcast:YES error:nil];
[udpSocket receiveWithTimeout:4 tag:UDPBROADCAST_MSG];
[udpSocket sendData:[@"X" dataUsingEncoding:NSASCIIStringEncoding] toHost:bcHost port:UDP_SOCKET_PORT withTimeout:-1 tag:UDPBROADCAST_MSG];
[udpSocket closeAfterSendingAndReceiving];
AsyncUdpSocket sometimes fetches the response, sometimes it doesn't. When I test in the lab with 3 tibbo's in it, sometimes it receives the answer from 1 or 2 tibbo's, sometimes from all of them... When I use wireshark to check, I ALWAYS see all tibbo's answering. So the tibbo's are doing what is asked from them, but AsyncUdpSocket seem to miss these responses. These responses come in within 0.03 second. I have to say that the problem doesn't only occur when multiple tibbo's are responding, even with only 1 tibbo responding, the data is often not coming in the didReceiveData delegate method.
Anyone has an idea what could cause this issue?