-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathserverclass.h
More file actions
27 lines (21 loc) · 771 Bytes
/
serverclass.h
File metadata and controls
27 lines (21 loc) · 771 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
#pragma once
#include <QObject>
#include <QTcpServer>
#include <QTcpSocket>
class ServerClass : public QObject
{
Q_OBJECT
public:
ServerClass(QObject *parent);
~ServerClass();
bool startServer(QString, quint16); // This is the method that is called when the server starts
void sendMessage(QString); // This is the method that is called when the server sends a message
protected slots:
void connection(); // This is the slot that is called when the server receives a connection
void receiveMessage(); // This is the slot that is called when the server receives a message
private:
QTcpServer *server;
QTcpSocket* socket;
signals:
void messageReceived(QString, int); // This is the signal that is emitted when the server receives a message
};