SocketServer端和SocketClient端传输解析
服务端和客户端的关系如下所示:
1.SocketServer绑定IP地址和端口,并开始监听端口
Server = socket.socket() Server.bind(("127.0.0.1", 8000)) # 元组形式,其中127.0.0.1为IP地址,8000为端口 Server.listen() # 监听端口 print("已监听窗口,等待连接...")
2.SocketClient建立连接
Client = socket.socket() Client.connect(("127.0.0.1", 8000)) print("客户端已与服务端建立连接")
标签:127.0,Socket,Python,编程,端口,Server,0.1,8000,socket From: https://www.cnblogs.com/cw12345/p/17027603.html