try/catch for socket example