Automatically detect if my mobile is connected to Internet
<pre><code>-(BOOL)IsConnectionAvailable{
    Reachability *reachability = [Reachability reachabilityForInternetConnection];   
    NetworkStatus networkStatus = [reachability currentReachabilityStatus];
    return !(networkStatus == NotReachable);
}
</code></pre>

<p>I am using above code and have to call that periodically to check if there is network connection.
I am working on chat application where i want to send messages immediately one the device get connected to network.</p>

<p>Thanks</p>