第72学习socketsever模块

socketsever里面有2大类:socketsever直接点击查看文档,有12个类
sever类:处理连接:"BaseServer", "TCPServer", "UDPServer","UnixStreamServer","UnixDatagramServer"
箭头是继承关系;

        | BaseServer |
+------------+
|
v
+-----------+ +------------------+
| TCPServer |------->| UnixStreamServer |
+-----------+ +------------------+
|
v
+-----------+ +--------------------+
| UDPServer |------->| UnixDatagramServer |
+-----------+ +--------------------+


class ForkingUDPServer(ForkingMixIn, UDPServer)
class ForkingTCPServer(ForkingMixIn, TCPServer)
class ThreadingUDPServer(ThreadingMixIn, UDPServer)
class ThreadingTCPServer(ThreadingMixIn, TCPServer)

 

都是实现并发的,

Forking:代表进程
Threading:代表线程

备注:1、在liunx上直接相互替换可以使用,但是Windows上不行
2、多进程的开销多余多线程。所有一般使用多线程,后面学习

 

request类:处理通信:"BaseRequestHandler", "StreamRequestHandler","DatagramRequestHandler",

箭头是继承关系;
        +-----------+                +------------------+
|BaseRequestHandler| ------->|StreamRequestHandler |
        +-----------+                 +------------------+
|
v
+-----------+
| DatagramRequestHandler
+-----------+

class DatagramRequestHandler(BaseRequestHandler)



 

你可能感兴趣的:(第72学习socketsever模块)