title: Quick detecting, if server is offline
body: <p>We use a PHP server and an iOS app.</p>
  
  <p>I use <code>NSURLConnection</code> to send a message to the server. If server is unavailable, e.g. the address is incorrect then we wait for an error after 60–90 secs. This is a long time.</p>
  
  <p>How do I decrease this time? Is there any quick function to check for server availability?</p>
  
  <p>If I first call</p>
  
  <pre><code>[request setTimeoutInterval:10];
  [request setHTTPBody:[message data]];
  </code></pre>
  
  <p>when I check [request timeoutInterval] it is still 240, not 10. So interesting..</p>
  
  <p>If I add a <code>setTimeoutInterval:</code> call before the connection is created like so:</p>
  
  <pre><code>[request setTimeoutInterval:10];
  connection = [[NSURLConnection alloc] initWithRequest: request delegate: self];
  </code></pre>
  
  <p>The request still returns after a long time.</p>