feat: TcpClient 客户端功能完成,且测试服务器和客户端之间的通讯成功
This commit is contained in:
@@ -31,6 +31,7 @@ QString ExTcpServer::getLocalIp()
|
||||
{
|
||||
QString hostName = QHostInfo::localHostName();
|
||||
QHostInfo hostInfo = QHostInfo::fromName(hostName);
|
||||
ui->plainTextEdit->appendPlainText("本机名称:" + hostName);
|
||||
QString locaIp;
|
||||
|
||||
QList<QHostAddress> list = hostInfo.addresses();
|
||||
@@ -96,7 +97,7 @@ void ExTcpServer::on_actQuit_triggered()
|
||||
void ExTcpServer::on_btnSend_clicked()
|
||||
{
|
||||
QString msg = ui->lineEdit->text();
|
||||
ui->plainTextEdit->appendPlainText("[out]" + msg);
|
||||
ui->plainTextEdit->appendPlainText("[服务器:]" + msg);
|
||||
ui->lineEdit->clear();
|
||||
ui->plainTextEdit->hasFocus();
|
||||
|
||||
@@ -108,7 +109,7 @@ void ExTcpServer::on_btnSend_clicked()
|
||||
void ExTcpServer::onSocketReadyRead() //读取缓冲区行文本
|
||||
{
|
||||
while (m_tcpSocket->canReadLine()) {
|
||||
ui->plainTextEdit->appendPlainText("[in]" + m_tcpSocket->readLine());
|
||||
ui->plainTextEdit->appendPlainText("[客户端:]" + m_tcpSocket->readLine());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>517</width>
|
||||
<height>314</height>
|
||||
<width>573</width>
|
||||
<height>341</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -96,7 +96,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>517</width>
|
||||
<width>573</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
Reference in New Issue
Block a user