title: AsyncUDPSocket broken pipe after locking phone with application suspended in background
body: <p>I'm using the <a href="http://code.google.com/p/cocoaasyncsocket/" rel="nofollow">AsyncUDPSocket</a> third party library in my iPhone app and for the most part it works great. I have a singleton instance of an <code>AsyncUDPSocket</code> that I use for all my network traffic. My app is registered for location tracking in the background and will wake up and send location update packet(s) over the network while running in the background. This all works smashingly running in the background, foreground, phone locked or unlocked, except when I do the following:</p>
  
  <ol>
  <li>Start my app</li>
  <li>Disable location tracking in my app settings
  (so no background waking up)</li>
  <li>Press the home button (app goes into background, socket is "freeze-dried" with rest of app)</li>
  <li>Lock phone</li>
  <li>Unlock phone</li>
  <li>Resume app</li>
  <li>Attempt to restart tracking and send something out the socket. As soon as I try, I get a <code>SIGPIPE</code>/<code>EPIPE</code> error and the app crashes.</li>
  </ol>
  
  <p>I figured the best way to deal with this would be to close and release the socket whenever the application exits and background tracking is not enabled, but when I try <code>[socket close]</code> or <code>[socket release]</code> on the <code>AsyncUDPSocket</code>, I get various <code>EXC_BAD_ACCESS</code> errors. I've filed a bug with the dev team, but was wondering if anyone here could give some ideas on how to either avoid the <code>SIGPIPE</code> error entirely or other ways to keep the socket alive without releasing it. Thanks.</p>