class ForkingServer (SocketServer.TCPServer, SocketServer.ForkingMixIn,): """time server , return the server time to client""" pass 但发现在本地开启了好几个客户端后服务端仍然只使用一个进程处理请求,为何?
class ForkingServer (SocketServer.TCPServer, SocketServer.ForkingMixIn,): 改成 class ForkingServer (SocketServer.ForkingMixIn, SocketServer.TCPServer ):
继承循序的问题
paw
2015-08-26 19:02:56 +08:00
PS :不推荐用自带库的这个 forkinng ,还不如下面来的方便 s = SocketServer.TCPServer (('', PORT ),HandlerClass ) for x in xrange (fork_process ): pos = x pid = os.fork () if pid == 0 : break