一.Socket
针对TCP/IP协议簇进行的程序封装,在Windows/Linux均有这样的底层模块。
二.
import socket # 定义一个客户端连接 def test_client(): s = socket.socket() s.connect(('192.168.19.130', 500)) content = "Hello World" s.send(content.encode('utf-8')) s.close() # 定义一个服务端连接: def test_server(): s = socket.socket() s.bind(('127.0.0.1', 500)) s.listen() chanel, client = s.accept() # 接收来自客户端的数据 print(client) test_server()
标签:网络通信,socket,server,content,client,test,500 From: https://www.cnblogs.com/eveplw/p/16653020.html