Three ideas that immediately come to mind are as follows:
customizeReset (reset the processor)
customizeRestart (restart the application)
configure the watchdog
You would be advised to look at the API reference guide for detailed information about these possibilities.
That said, is the system truly frozen or are network sockets just not available (I am assuming that your device has network availability or course). For example can you "ping" the device.
If the device is truly frozen then one of the ideas above might help. If it is an issue of out of sockets then there are other things you can look at.