From 0965a281f52cada2d5017cf422befcbfc09d0f32 Mon Sep 17 00:00:00 2001 From: Jimmy Xiang Date: Fri, 4 Dec 2020 22:11:58 +0800 Subject: [PATCH] update -4 --- 04/client.py | 2 +- 04/server.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/04/client.py b/04/client.py index 65f1125..36fc32b 100644 --- a/04/client.py +++ b/04/client.py @@ -1,7 +1,7 @@ import socket sock_ = socket.socket(socket.AF_INET,socket.SOCK_STREAM) -sock_.connect((socket.gethostname(),9337)) +sock_.connect(("localhost",9337)) msg = sock_.recv(1024) sock_.close() print(msg.decode("ascii")) diff --git a/04/server.py b/04/server.py index 547c4a9..827486c 100644 --- a/04/server.py +++ b/04/server.py @@ -1,6 +1,6 @@ import socket -host = socket.gethostname() +host = "localhost" port = 9337 sock_ = socket.socket(socket.AF_INET,socket.SOCK_STREAM) @@ -15,4 +15,4 @@ print("Connection established with: ",str(addr)) message = "\nThank you for connecting "+str(addr) conn.send(message.encode("ascii")) -conn.close() \ No newline at end of file +conn.close()