12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- #ifndef CLIENTSOCKET_H
- #define CLIENTSOCKET_H
- #include <QObject>
- #include <QtNetwork>
- #define CLIENT_ID "cliId"
- class ClientSocket : public QObject
- {
- Q_OBJECT
- Q_PROPERTY(bool udpOnly READ UdpOnly WRITE setUdpOnly)
- public:
- explicit ClientSocket(QObject *parent = 0);
- ~ClientSocket();
- bool UdpOnly();
- void setUdpOnly(bool);
- private:
- void startTcpCommunication(const QHostAddress& address);
- void writeLog(QString log);
- signals:
- void clientLog(QString log);
- void connected(QString address);
- private slots:
- void udpGetData();
- void readServerTcpData();
- void connectedToServer();
- public slots:
- void start();
- void stop();
- void sendToServer(QString msg);
- private:
- QUdpSocket* iUdpDiscoverySocket;
- QTcpSocket* iCommTcpSocket;
- bool udpOnly;
- QString iServerAddress;
- };
- #endif // CLIENTSOCKET_H
|