⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dialogimpl.cpp

📁 在LINUX平台下
💻 CPP
字号:
#include "dialogimpl.h"//DialogImpl::DialogImpl( QWidget * parent, Qt::WFlags f) 	: QDialog(parent, f){	setupUi(this);	connect(ReceiveButton,SIGNAL(clicked()),this,SLOT(ReceiveFromClient()));	connect(StartServerButton,SIGNAL(clicked()),this,SLOT(startServer()));	connect(&tcpServer,SIGNAL(newConnection()),this,SLOT(acceptConnection()));  connect(QuitButton, SIGNAL(clicked()), this, SLOT(close()));}void DialogImpl:: startServer(){	while(!tcpServer.isListening()&&!tcpServer.listen(QHostAddress::LocalHost,16689))	{	QMessageBox messageBox(QMessageBox::Question,"Fail","Listening fail");	messageBox.exec();	}	StartServerButton->setEnabled(false);	}void DialogImpl:: ReceiveFromClient(){		char data[1024];     tcpServerConnection->read(data,1024);	  QString str(data);      ReceiveText->setText(str);	StartServerButton->setEnabled(true);		}void DialogImpl::acceptConnection(){	//表示接受到了一个新的连接	tcpServerConnection=tcpServer.nextPendingConnection();		QMessageBox messageBox(QMessageBox::Question,"New Connection","New Connection");	messageBox.exec();		}//

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -