I would do something like this(that is, if I understand your problem correctly):
Code:
while( someCondition )
{
   try
   {
       //do funky socket stuff here
   }
   catch ( AppropriateException ex )
   {
      //deal with the exception - log it, display a message or just ignore it
   } 
}
Now whenever the exception is thrown, you deal with it in the catch block and the program resumes execution at the top of the while block.