gusucode.com > qt实现的多线程服务器和客户端源码程序 > qt实现的多线程服务器和客户端源码程序/qtserver/server/shopserver.cpp

    #include <QtDebug>
#include "shopserver.h"
#include "shopthread.h"

#include <stdlib.h>

//! [0]
namespace HztqLee
{
ShopServer::ShopServer(QObject *parent)
    : QTcpServer(parent)
{

}
//! [0]

//! [1]
void ShopServer::incomingConnection(int socketDescriptor)
{
    ShopThread *thread = new ShopThread(socketDescriptor, this);
    connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
    connect(thread, SIGNAL(finished()), this, SLOT(discon()));
    thread->start();
}
void ShopServer::discon(){
			qDebug() << "disconnect";
}
}//! [1]