Iam using an iPhone app chat uses socket connection to communicate with the server. When the app is moved to background i can see that the server is able to communicate with
From Apple's IOS Programming Guide
Most applications that enter the background state are moved to the suspended state shortly thereafter. While in this state, the application does not execute any code and may be removed from memory at any time. Applications that provide specific services to the user can request background execution time in order to provide those services.
That at least explains, why the app stops executing. Why your server is still able to communicate with your app for 5 minutes may be, because you set an extra long time out and are not closing the socket connection explicitly on your app entering the background.