You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

42 lines
727 B

#ifndef WIDGET_H
#define WIDGET_H
#include <QWidget>
#include <QTcpServer>
#include <QTcpSocket>
namespace Ui {
class Widget;
}
class Widget : public QWidget
{
Q_OBJECT
public:
explicit Widget(QWidget *parent = 0);
~Widget();
//声明tcp所用的对象
QTcpServer *tcpServer;
QTcpSocket *tcpSocket;
private slots:
void on_btnOpenServer_clicked();
//2.有新连接时创建tcpsocket
void newConnection_Slot();
//3.读取就绪时读取数据
void readyRead_SLOT();
//4. 关闭服务器
void on_btnCloseServer_clicked();
//5. 发送数据
void on_btnSendMessage_clicked();
void on_btnCloseNow_clicked();
private:
Ui::Widget *ui;
};
#endif // WIDGET_H