diff --git a/python/paddle_serving_server/__init__.py b/python/paddle_serving_server/__init__.py index 155f0b8036c868681ca0a72f241b11c8aea218a5..ed4c6b76110e6fb6a4bce41d04d3b84d3857d5ba 100644 --- a/python/paddle_serving_server/__init__.py +++ b/python/paddle_serving_server/__init__.py @@ -256,7 +256,7 @@ class Server(object): def port_is_available(self, port): with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock: sock.settimeout(2) - result = sock.connect_ex(('127.0.0.1', port)) + result = sock.connect_ex(('0.0.0.0', port)) if result != 0: return True else: diff --git a/python/paddle_serving_server/web_service.py b/python/paddle_serving_server/web_service.py index a0300a0802e740e7c6e4d4d8f3b3c7c5a8862d3b..71614129d0b8ae923de71d4aa7c30efbe3a8c86a 100755 --- a/python/paddle_serving_server/web_service.py +++ b/python/paddle_serving_server/web_service.py @@ -54,7 +54,7 @@ class WebService(object): client_service = Client() client_service.load_client_config( "{}/serving_server_conf.prototxt".format(self.model_config)) - client_service.connect(["127.0.0.1:{}".format(self.port + 1)]) + client_service.connect(["0.0.0.0:{}".format(self.port + 1)]) service_name = "/" + self.name + "/prediction" @app_instance.route(service_name, methods=['POST']) diff --git a/python/paddle_serving_server_gpu/__init__.py b/python/paddle_serving_server_gpu/__init__.py index 43ac935ce89afee6baa10c041c946b2c29f5258e..d8bcd7bbf6aa827ff80fa455726b6f3f356eb810 100644 --- a/python/paddle_serving_server_gpu/__init__.py +++ b/python/paddle_serving_server_gpu/__init__.py @@ -266,7 +266,7 @@ class Server(object): def port_is_available(self, port): with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock: sock.settimeout(2) - result = sock.connect_ex(('127.0.0.1', port)) + result = sock.connect_ex(('0.0.0.0', port)) if result != 0: return True else: diff --git a/python/paddle_serving_server_gpu/web_service.py b/python/paddle_serving_server_gpu/web_service.py index d30f1bfb0c0b7c40e32fe62e53e9882dce4cd18b..fbb52470d48f45795c6e910600a1368d4bf3d8d2 100755 --- a/python/paddle_serving_server_gpu/web_service.py +++ b/python/paddle_serving_server_gpu/web_service.py @@ -95,7 +95,7 @@ class WebService(object): client_service = Client() client_service.load_client_config( "{}/serving_server_conf.prototxt".format(self.model_config)) - client_service.connect(["127.0.0.1:{}".format(self.port + i + 1)]) + client_service.connect(["0.0.0.0:{}".format(self.port + i + 1)]) client_list.append(client_service) time.sleep(1) service_name = "/" + self.name + "/prediction" diff --git a/tools/cpp_examples/bert-gpu-serving/paddle-gpu-serving/paddle_gpu_serving/run/__init__.py b/tools/cpp_examples/bert-gpu-serving/paddle-gpu-serving/paddle_gpu_serving/run/__init__.py index 5d5542ce2ddb23bb6de07b8e7f3210b470569331..897812286d65d1ee6697bf0febce809c76c340b7 100644 --- a/tools/cpp_examples/bert-gpu-serving/paddle-gpu-serving/paddle_gpu_serving/run/__init__.py +++ b/tools/cpp_examples/bert-gpu-serving/paddle-gpu-serving/paddle_gpu_serving/run/__init__.py @@ -80,7 +80,7 @@ class BertServer(): def build_server(self): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - sock.bind(('127.0.0.1', self.port)) + sock.bind(('0.0.0.0', self.port)) sock.listen(5) print('Main server serving on {} port.'.format(self.port)) while True: @@ -122,7 +122,7 @@ class BertServer(): with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock: sock.settimeout(2) - result = sock.connect_ex(('127.0.0.1', port)) + result = sock.connect_ex(('0.0.0.0', port)) if result != 0: return port return -1