-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.cpp
More file actions
34 lines (23 loc) · 995 Bytes
/
server.cpp
File metadata and controls
34 lines (23 loc) · 995 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "server.h"
Server::Server(QObject *parent) :
QTcpServer(parent)
{
/* get current dialog object */
dialog = dynamic_cast<outbound *>(parent);
//dialognewdoc = dynamic_cast<newdoc *>(parent);
}
Server::~Server()
{
}
void Server::incomingConnection(int socketDescriptor)//有客户端进入
{
socketList.append(socketDescriptor);
serverThread *thread = new serverThread(socketDescriptor, 0);
connect(thread, SIGNAL(started()), dialog, SLOT(showConnection()));
connect(thread, SIGNAL(disconnectTCP(int)), dialog, SLOT(showDisconnection(int)));
connect(thread, SIGNAL(revData(QString, QByteArray)), dialog, SLOT(revData(QString, QByteArray)));
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
connect(dialog, SIGNAL(sendData(QByteArray, int)), thread, SLOT(sendData(QByteArray, int)));
//connect(dialognewdoc, SIGNAL(sendDatanewdoc(QByteArray, int)), dialog, SLOT(sendMsg(QByteArray, int)));
thread->start();
}