UDP socket starting to fail to receive
I have a very annoying bug showing up.
We have left our iPhone app running overnight.
Every 2 seconds it sends a broadcast ping out on to the network via the open socket to inform that the device is alive. Now the other application detects that ping and attempts to send messages back. The problem is that despite the ping continuing to go out no packets ever get received.
This only seems to happen after several hours (annoyingly we've only ever managed to get this overnight). It then seems to leave the iph开发者_StackOverflow社区one in a very confused state where even after restarting the app it is still unable to receive the packets. Eventually after a time (sorry I have no idea how long) the phone starts re-acting normally and I can continue.
I'm guessing that somewhere along the line iOS is blocking the socket from receiving data (but oddly not sending on the same socket!).
Has anyone any idea what this might be and, more importantly, how I might solve the issue?
Well this turned out to be a very strange problem.
I broke out a packet sniffer to inspect what was going on and I found that my PC was sending out ARP broadcasts trying to identify who had the ip address. These ARP requests were not getting answered by the router or the iPhone.
This was very strange.
In the end I started checking the wifi access point I was attached to. I disabled the wifi on it forcing us to use a different (though slightly weaker) access point and suddenly the ARP requests were getting answered and everything jumped into life.
It was at this point that I remembered that my Boss had tripped over the wire of the access point and it had come crashing to the ground. It "seemed" to work .. but, evidently, he broke "something" :(
The problem is now no more!
精彩评论