smarter exception handling for sync send to socket