03python网络编程
介绍python网络编程相关知识
一越王超
软件系统工程师
展开
-
python--网络编程 07 socketserver模块 解决TCP协议中服务器不能连接多个客户端的问题
思考:TCP协议中,服务器不能连接多个客户端,怎么解决?在服务器端使用socketserver模块可以解决这个问题原创 2020-02-08 13:55:21 · 482 阅读 · 0 评论 -
python--网络编程 06 客户端登录校验
思考:如何实现登录验证?原创 2020-02-08 13:53:23 · 193 阅读 · 0 评论 -
python--网络编程 01 socket常见方法总结
服务端套接字函数s.bind() 绑定(主机,端口号)到套接字s.listen() 开始TCP监听s.accept() 被动接受TCP客户的连接,(阻塞式)等待连接的到来客户端套接字函数s.connect() 主动初始化TCP服务器连接s.connect_ex() connect()函数的扩展版本,出错时返回出错码,而不是抛出异常公共用途的套接字函数...原创 2020-02-08 11:35:51 · 353 阅读 · 0 评论 -
python--网络编程 04 目录切换
思考:如何进行目录切换原创 2020-02-07 16:44:06 · 186 阅读 · 0 评论 -
python--网络编程 03 执行操作系统命令
思考:如何用python程序调用操作系统命令?客户端发送要执行的命令 服务器执行,将执行结果返回给客户端 客户端拿到结果呈现到用户面前利用subprocess模块可以实现。#用OS模块可以执行操作系统命令,但缺点是错误命令则打印不出来import osr = os.popen('ipconfig') #popen()作用是执行命令,如果是错误命令则打印不出来print(...原创 2020-02-07 13:47:52 · 330 阅读 · 0 评论 -
python--网络编程 04 文件传输
思考:如何实现文件的上传下载?小文件的上传下载:大文件的上传下载:原创 2020-02-07 13:09:55 · 193 阅读 · 0 评论 -
python--网络编程 02 粘包
思考:什么是粘包?同时执行多条命令之后,得到的结果很可能只有一部分,在执行其他命令的时候又接收到之前执行的另外一部分结果,这种显现就是粘包。例如:send(b'123')send(b'abc')recv(4) --> 1234 #应该接收123recv(4) --> bc #应该接收abc或者发送的数据量大,一次没有接收完,等下一次接收又收...原创 2020-02-07 00:28:04 · 154 阅读 · 0 评论 -
python--网络编程 00 计算机网络相关知识
思考:计算机如何组成通信网络?同一台计算机的两个文件如何通信:打开对方文件 两台计算机之间如何通信:通过网线 多个计算机之间如何通信:利用交换机的广播 单播 组播 更多计算机之间如何通信:交换机 + 路由器 目录 网络相关概念 局域网与交换机 广域网与路由器 相关概念 广播 ip地址与ip协议 端口 mac地址 arp协议 ——查询IP地址和MAC地...原创 2020-02-06 22:53:52 · 226 阅读 · 0 评论 -
python--网络编程 01 socket
如果你写了两个python文件a.py和b.py,分别去运行,你就会发现,这两个python的文件分别运行的很好。但是如果这两个程序之间想要传递一个数据,你要怎么做呢?这个问题以你现在的知识就可以解决了,我们可以创建一个文件,把a.py想要传递的内容写到文件中,然后b.py从这个文件中读取内容就可以了。但是当你的a.py和b.py分别在不同电脑上的时候,你要怎么办呢?类似的机...原创 2020-02-05 20:26:21 · 221 阅读 · 0 评论