• 5218阅读
  • 1回复

关于QT多线程 [复制链接]

上一主题 下一主题
离线圆融一笑
 
只看楼主 倒序阅读 楼主  发表于: 2007-09-07
— 本帖被 XChinux 从 General Qt Programming 移动到本区(2011-01-02) —
void Chat::socketServer()
{
    serverBool = true;
    server = new QTcpServer(this);
    serverSocket = new QTcpSocket(this);
    server->listen(QHostAddress::Any, port);
    //connect(server, SIGNAL(newConnection()), this, SLOT(newConnectionSlot()));
     serverThread *thread = new serverThread(socketDescriptor, content, this);
    connect(thread, SIGNAL(newConnection()), thread, SLOT(newConnectionSlot()));
    thread->start();
     content = writeMessageEdit->toPlainText();
}

做了一个tcp的聊天程序,想实现一对多,多对多聊天,于是使用了线程,但是好象没什么反应,连都连不上了。是不是有什么特别的设置或者程序错误。现在有点头晕,都不知道从何查起。
请求高手指教
离线foxyz

只看该作者 1楼 发表于: 2007-09-10
一般的线程程序都是先subclass 一个QThread然后再instantiate,然后。。。。
快速回复
限100 字节
 
上一个 下一个