-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMySocketServer.cpp
More file actions
45 lines (29 loc) · 1.19 KB
/
Copy pathMySocketServer.cpp
File metadata and controls
45 lines (29 loc) · 1.19 KB
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
34
35
36
37
38
39
40
41
42
43
#include "MySocketServer.h"
#include <stdlib.h>
//! [0]
MySocketServer::MySocketServer(QObject *parent)
: QTcpServer(parent)
{
statServer.repaintstat();
statServer.show();
}
void MySocketServer::incomingConnection(int socketDescriptor)
{
cout << ""<<endl;
cout << ""<<endl;
cout << ""<<endl;
cout << ""<<endl;
cout << "(II) Launching the Network monitor process" << endl;
// CREATION DE L'OBJET EN CHARGE DES REPONSES RESEAU
MySocketClient *thread = new MySocketClient(socketDescriptor, this);
//CONNEXIONS DES SLOTS ET SIGNAUX
connect(thread ,SIGNAL(requestHTML()), &statServer, SLOT(statHTML()));//Slot mettant a jour la page html statistiques
connect(thread ,SIGNAL(newstat()), &statServer, SLOT(repaintstat()));//Slot mettant a jour le widget statistiques
// ON INDIQUE QUE LORSQU'UN CLIENT SE CONNECTE ON DELEGE LA REPONSE
// AU PROCESSUS DEFINI CI DESSUS...
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
// ON DEMARRE LE PROCESSUS DE REPONSE POUR LE METTRE EN ATTENTE !
thread->start();
// PUIS ON REND LA MAIN EN ATTENTE D'UN CLIENT
cout << "(II) Network monitor process launch : OK" << endl;
}