diff --git a/java/README_CN.md b/java/README_CN.md old mode 100644 new mode 100755 index 70162e8778595456c3a006055c751dd051b2d93c..a656203a5a7fdd1ca3d8fc434d89dd537e6c6413 --- a/java/README_CN.md +++ b/java/README_CN.md @@ -98,7 +98,7 @@ java -cp paddle-serving-sdk-java-examples-0.0.1-jar-with-dependencies.jar Pipeli ### 注意事项 -1.在示例中,端口号都是9393,ip默认设置为了0.0.0.0表示本机,注意ip和port需要与Server端对应。 +1.在示例中,端口号都是9393,ip默认设置为了127.0.0.1表示本机,注意ip和port需要与Server端对应。 2.目前Serving已推出Pipeline模式(原理详见[Pipeline Serving](../doc/PIPELINE_SERVING_CN.md)),面向Java的Pipeline Serving Client已发布。 diff --git a/java/examples/src/main/java/PaddleServingClientExample.java b/java/examples/src/main/java/PaddleServingClientExample.java index 73fe94856ff90177f7fa34535f2a2733c92068e3..153cc4afdd172b524383a78b8d1340ecebf1cc44 100755 --- a/java/examples/src/main/java/PaddleServingClientExample.java +++ b/java/examples/src/main/java/PaddleServingClientExample.java @@ -25,7 +25,7 @@ public class PaddleServingClientExample { List fetch = Arrays.asList("price"); Client client = new Client(); - client.setIP("0.0.0.0"); + client.setIP("127.0.0.1"); client.setPort("9393"); client.loadClientConfig(model_config_path); String result = client.predict(feed_data, fetch, true, 0); @@ -49,7 +49,7 @@ public class PaddleServingClientExample { Client client = new Client(); //注意:跨docker,需要设置--net-host或直接访问另一个docker的ip - client.setIP("0.0.0.0"); + client.setIP("127.0.0.1"); client.setPort("9393"); client.set_http_proto(false); client.loadClientConfig(model_config_path); @@ -73,7 +73,7 @@ public class PaddleServingClientExample { List fetch = Arrays.asList("price"); Client client = new Client(); - client.setIP("0.0.0.0"); + client.setIP("127.0.0.1"); client.setPort("9393"); client.loadClientConfig(model_config_path); client.set_use_grpc_client(true); @@ -97,7 +97,7 @@ public class PaddleServingClientExample { List fetch = Arrays.asList("price"); Client client = new Client(); - client.setIP("0.0.0.0"); + client.setIP("127.0.0.1"); client.setPort("9393"); client.loadClientConfig(model_config_path); client.use_key(keyFilePath); @@ -125,7 +125,7 @@ public class PaddleServingClientExample { List fetch = Arrays.asList("price"); Client client = new Client(); - client.setIP("0.0.0.0"); + client.setIP("127.0.0.1"); client.setPort("9393"); client.loadClientConfig(model_config_path); client.set_request_compress(true); @@ -176,7 +176,7 @@ public class PaddleServingClientExample { }}; List fetch = Arrays.asList("save_infer_model/scale_0.tmp_0"); Client client = new Client(); - client.setIP("0.0.0.0"); + client.setIP("127.0.0.1"); client.setPort("9393"); client.loadClientConfig(model_config_path); String result = client.predict(feed_data, fetch, true, 0); @@ -198,7 +198,7 @@ public class PaddleServingClientExample { }}; List fetch = Arrays.asList("pooled_output"); Client client = new Client(); - client.setIP("0.0.0.0"); + client.setIP("127.0.0.1"); client.setPort("9393"); client.loadClientConfig(model_config_path); String result = client.predict(feed_data, fetch, true, 0); @@ -268,7 +268,7 @@ public class PaddleServingClientExample { }}; List fetch = Arrays.asList("prob"); Client client = new Client(); - client.setIP("0.0.0.0"); + client.setIP("127.0.0.1"); client.setPort("9393"); client.loadClientConfig(model_config_path); String result = client.predict(feed_data, fetch, true, 0); diff --git a/java/src/main/java/io/paddle/serving/client/Client.java b/java/src/main/java/io/paddle/serving/client/Client.java index 5c283635f3c3146b5c9e3d227f1ee6485e24d5c6..63e861ba6199c7a56129c4d3b0cb03a77d26f6b7 100755 --- a/java/src/main/java/io/paddle/serving/client/Client.java +++ b/java/src/main/java/io/paddle/serving/client/Client.java @@ -134,7 +134,7 @@ public class Client { feedTensorLen_ = null; feedNameToIndex_ = null; timeoutS_ = 200000; - ip = "0.0.0.0"; + ip = "127.0.0.1"; port = "9393"; serverPort = "9393"; serviceName = "/GeneralModelService/inference"; diff --git a/python/paddle_serving_client/httpclient.py b/python/paddle_serving_client/httpclient.py index 9dc414316fbb93bc59867f44c663ba1f59c729a3..e6ea65a40fd8436a1db0be8fa0d94ba33e64285e 100755 --- a/python/paddle_serving_client/httpclient.py +++ b/python/paddle_serving_client/httpclient.py @@ -75,7 +75,7 @@ def data_bytes_number(datalist): # 或者直接调用grpc_client_predict() class HttpClient(object): def __init__(self, - ip="0.0.0.0", + ip="127.0.0.1", port="9393", service_name="/GeneralModelService/inference"): self.feed_names_ = [] diff --git a/python/paddle_serving_server/serve.py b/python/paddle_serving_server/serve.py index abccf5e179ccd4946fdf51a5f74ff6e5ee685b4c..8531e83fc1bb3a330d276e0c0d72616a810eea72 100755 --- a/python/paddle_serving_server/serve.py +++ b/python/paddle_serving_server/serve.py @@ -37,7 +37,7 @@ import socket def port_is_available(port): with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock: sock.settimeout(2) - result = sock.connect_ex(('0.0.0.0', port)) + result = sock.connect_ex(('127.0.0.1', port)) if result != 0: return True else: diff --git a/python/paddle_serving_server/server.py b/python/paddle_serving_server/server.py old mode 100644 new mode 100755 index d1d3155112e44b0c71faa0bdd704dffa826aa077..078f3702d125d5829cf1336b1b69493d471170fd --- a/python/paddle_serving_server/server.py +++ b/python/paddle_serving_server/server.py @@ -537,7 +537,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(('0.0.0.0', port)) + result = sock.connect_ex(('127.0.0.1', 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 old mode 100644 new mode 100755 index e6405fbf2f06a895241ed1bf4b813ade7b42ed7a..52e394b2c07fd85b0da7be591c0b9a77669e19b6 --- a/python/paddle_serving_server/web_service.py +++ b/python/paddle_serving_server/web_service.py @@ -33,7 +33,7 @@ from paddle_serving_server.serve import format_gpu_to_strlist def port_is_available(port): with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock: sock.settimeout(2) - result = sock.connect_ex(('0.0.0.0', port)) + result = sock.connect_ex(('127.0.0.1', port)) if result != 0: return True else: diff --git a/python/pipeline/util.py b/python/pipeline/util.py old mode 100644 new mode 100755 index d7847f179de7557b5446958536008adc3c981f95..8bc15446b81c24162bbe2e236f204ffd1d0c23d1 --- a/python/pipeline/util.py +++ b/python/pipeline/util.py @@ -39,7 +39,7 @@ class AvailablePortGenerator(object): def port_is_available(port): with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock: sock.settimeout(2) - result = sock.connect_ex(('0.0.0.0', port)) + result = sock.connect_ex(('127.0.0.1', port)) if result != 0: return True else: