Added SocketError exception handling