def _verify_port(host, port): s = socket.socket() try: s.bind((host, port)) except socket.error as e: raise exception.SocketPortInUseException(host=host, port=port, error=e) finally: s.close()
def _verify_port(host, port): af = socket.AF_INET6 if ":" in host else socket.AF_INET s = socket.socket(af) try: s.bind((host, port)) except socket.error as e: raise exception.SocketPortInUseException(host=host, port=port, error=e) finally: s.close()
def port_10000_already_used(host, port): if port == 10000 and host == '127.0.0.1': raise exception.SocketPortInUseException( port=port, host=host, error="already in use")