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.
37 lines
629 B
37 lines
629 B
#ifndef WIDGET_H
|
|
#define WIDGET_H
|
|
|
|
#include <QWidget>
|
|
//只需要引入socket
|
|
#include <QTcpSocket>
|
|
|
|
namespace Ui {
|
|
class Widget;
|
|
}
|
|
|
|
class Widget : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit Widget(QWidget *parent = 0);
|
|
~Widget();
|
|
//1.socket对象
|
|
QTcpSocket *tcpSocket;
|
|
|
|
private slots:
|
|
void on_btnConnect_clicked();
|
|
//3.连接成功槽函数
|
|
void connected_Slot();
|
|
//4.新数据到来时触发的槽函数
|
|
void readyRead_Slot();
|
|
//5.发送数据
|
|
void on_btnSend_clicked();
|
|
//6.关闭连接
|
|
void on_btnClose_clicked();
|
|
|
|
private:
|
|
Ui::Widget *ui;
|
|
};
|
|
|
|
#endif // WIDGET_H
|
|
|