我的多进程程序bot python有什么问题?

时间:2019-03-10 06:03:08

标签: python multithreading python-multiprocessing python-multithreading

我正在尝试处理我的客户,但是以某种方式我自己的代码总是挂起,不再让我再次执行命令bot> id

我正在尝试

[*]新建连接127.0.0.1:33072 BotHandler-x

[*]新建连接127.0.0.1:33072 BotHandler-x

[*]新建连接127.0.0.1:33072 BotHandler-x

然后执行bot> whoami,但是它总是在尝试执行某些操作之前挂起

class BotCmd(multiprocessing.Process):
    def __init__(self, qv2):
        multiprocessing.Process.__init__(self)
        self.q = qv2

    def run(self):
        while True:
            try:
                SendCmd = str(input("BotCmd> "))
                if (SendCmd == ""):
                    pass
                elif (SendCmd == "exit"):
                    for i in range(len(Socketthread)):
                        time.sleep(0.1)
                        self.q.put(SendCmd)
                    time.sleep(5)
                    os._exit(0)
                else:
                    print("[+] Sending Command: " + SendCmd + " to " + str(len(Socketthread)) + " bots")
                    for i in range(len(Socketthread)):
                        time.sleep(0.1)
                        self.q.put(SendCmd)         
            except EOFError as e:
                break

0 个答案:

没有答案