收集整理了一份《2024年最新物联网嵌入式全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升的朋友。
需要这些体系化资料的朋友,可以加我V获取:vip1024c (备注嵌入式)
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人
都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
QT += network
dialog.h
#ifndef DIALOG\_H
#define DIALOG\_H
#include <QDialog>
#include <QLabel>
#include <QPushButton>
class TimeServer;
class Dialog : public QDialog
{
Q_OBJECT
public:
Dialog(QWidget \*parent = 0);
~Dialog();
private:
QLabel \*Label1; //此标签用于显示监听端口
QLabel \*Label2; //此标签用于显示请求次数
QPushButton \*quitBtn; //退出
TimeServer \*timeServer; //TCP 服务器端 timeserver
int count; //请求次数计数器 coun
public slots:
void slotShow ();
} ;
#endif // DIALOG\_H
timeserver.h
#ifndef TIMESERVER\_H
#define TIMESERVER\_H
#include <QTcpServer>
class Dialog;
class TimeServer : public QTcpServer
{
Q_OBJECT
public:
TimeServer(QObject \*parent=0);
protected:
/\*重写此虚函数。这个函数在 TCP服务器端有新的连接时被调用,其参数为所接收新连接的套接字描述符。\*/
void incomingConnection(qintptr socketDescriptor);
private:
/\*用于记录创建这个 TCP 服务器端对象的父类,这里是界面指针,通过这个指针将线程发出的消息关联到界面的槽函数中。\*/
Dialog \*dig;
};
#endif // TIMESERVER\_H