1 Star 0 Fork 1

冷月宫主/VirtualDtu

forked from yuyaowen/VirtualDtu 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
netsocket.h 1.21 KB
一键复制 编辑 原始数据 按行查看 历史
yuyaowen 提交于 2021-01-27 10:42 . first commit
#ifndef NETSOCKET_H
#define NETSOCKET_H
#include <QObject>
#include <QString>
#include <QStringList>
#include <QTcpSocket>
#include <QTcpServer>
#include <QUdpSocket>
#include <QNetworkDatagram>
#include <QAbstractSocket>
#include <QByteArray>
#include <QList>
enum NetProtocol {TCP_SERVER, TCP_CLIENT, UDP};
struct udpRemoteClient {
QHostAddress ip;
quint16 port;
};
class NetSocket : public QObject
{
Q_OBJECT
public:
NetSocket();
~NetSocket();
void socketStart();
void socketStop();
enum NetProtocol protocol = TCP_SERVER;
QStringList IPList;
QTcpServer *tcpServerSock = Q_NULLPTR;
QTcpSocket *curClient = Q_NULLPTR;
QUdpSocket *udpSock;
struct udpRemoteClient udpClient;
QList<QTcpSocket *> clientList;
QByteArray tcpData;
bool isHexDisplay = true;
bool isHexSend = true;
bool isOnline = false;
QString ipAddr;
int port;
int udpRemotePort;
signals:
void readDone();
void socketChanged();
public slots:
private slots:
void tcpServerNewConnection();
void tcpServerAccepterr(QAbstractSocket::SocketError socketError);
void tcpClientErr(QAbstractSocket::SocketError socketError);
void readData();
};
#endif // NETSOCKET_H
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/E_wsq/virtual-dtu.git
[email protected]:E_wsq/virtual-dtu.git
E_wsq
virtual-dtu
VirtualDtu
master

搜索帮助