Make the socket parser more general