From 77a4947ecdf5af73975eaff38f05783741916075 Mon Sep 17 00:00:00 2001 From: doublepi123 <54027436+doublepi123@users.noreply.github.com> Date: Sat, 18 Apr 2020 16:01:00 +0800 Subject: [PATCH] =?UTF-8?q?Update=2014.=E7=BD=91=E7=BB=9C=E7=BC=96?= =?UTF-8?q?=E7=A8=8B=E5=85=A5=E9=97=A8=E5=92=8C=E7=BD=91=E7=BB=9C=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E5=BC=80=E5=8F=91.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 监听127.0.0.1避免192.168.1.2不是本机IP而报错的情况 --- Day01-15/14.网络编程入门和网络应用开发.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Day01-15/14.网络编程入门和网络应用开发.md b/Day01-15/14.网络编程入门和网络应用开发.md index 02f2b4a..3f46046 100644 --- a/Day01-15/14.网络编程入门和网络应用开发.md +++ b/Day01-15/14.网络编程入门和网络应用开发.md @@ -151,7 +151,7 @@ def main(): server = socket(family=AF_INET, type=SOCK_STREAM) # 2.绑定IP地址和端口(端口用于区分不同的服务) # 同一时间在同一个端口上只能绑定一个服务否则报错 - server.bind(('192.168.1.2', 6789)) + server.bind(('127.0.0.1', 6789)) # 3.开启监听 - 监听客户端连接到服务器 # 参数512可以理解为连接队列的大小 server.listen(512) @@ -414,4 +414,4 @@ def main(): if __name__ == '__main__': main() -``` \ No newline at end of file +```