refactored socket exception handling
Merge pull request #94 from zelgerj/master

refactored socket exception handling