Reputation: 5435
My iPhone application is using AsyncUdpSocket to handle a UDP socket. However, when my application goes into the background in iOS 4.0 and returns to the foreground, I am getting the following error:
Application 'MyAppName' exited abnormally with signal 13: Broken pipe
This is because my sockets are disconnected when my application goes to the background.
How can I avoid this and run UDP sockets in the background?
Upvotes: 6
Views: 3094
Reputation: 84159
This is not related to UDP. EPIPE
only happens for "stream" file descriptors - Unix pipes and TCP sockets.
I'm guessing you have some sort of a control TCP connection which times out on the remote end when you go into background. You need to figure out how to keep it alive or re-connect when the app wakes up.
You can also handle (or ignore) EPIPE
, see sigaction(2)
, and react to it accordingly on return from write(2)
.
Upvotes: 2