I am trying to validate weather the connection was successful but have been getting inconstant results. When I try to do an synchronous request using a bogus url with:
NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
if (responseData)
{
did_send = TRUE;
}
else
{
did_send = FALSE;
}
It hangs for a while an eventually returns:
did_send = FALSE;
But if I do an asynchronous request using a bogus url with:
NSURLConnection *conn=[[NSURLConnection alloc] initWithRequest:request delegate:self ];
if (conn)
{
did_send = TRUE;
}
else
{
did_send = FALSE;
}
I get:
did_send = TRUE;
every time. I need to get the asynchronous request working because I am able to set a timeout and not have to hang for 60 sec while the request times out with the default time out duration that is unchangeable with the asynchronous requests. Any ideas?