Example #1
0
    def incomingConnection(self, voidptr):
        print("a new connection from %s and the num of client is %s" %
              (str(voidptr), len(self.threadPool) + 1))

        clientThread = ClientThread(voidptr)
        clientThread.disconnectToClientSignal.connect(
            self.disconnectToClientSlot)  # 断开连接后的资源释放
        clientThread.getMsgFromClientSignal.connect(
            self.getMsgFromClientSlot)  # 从客户端获取消息
        self.threadPool.append(clientThread)  # 线程池添加
        clientThread.run()  # 开启线程
Example #2
0
def handle_client(client_socket, client_address):
    client_thread = ClientThread(client_socket, client_address,
                                 ClientsDatabase)
    client_thread.run()