Thank you for your reply!
In the client's send function I added
tcpSocket->write(block);
connect(tcpSocket,SIGNAL(bytesWritten(qint64)),thi s,SLOT(flag()));
....
void Client::flag(){
QMessageBox::information(this, tr("Fortune Client"),
tr("data has been sent"));
}
but there is no QMessageBox,and in the server's send function I added
tcpsocket = tcpServer->nextPendingConnection();
tcpsocket->write(block);
connect(tcpsocket,SIGNAL(readyRead()),this,SLOT(re adTest()));
.....
void Server::readTest(){
statusLabel->setText("ready read");//statusLabel is a label on the window
}
there is also no "ready read".
Here in the loop,after the server feels connection,it sends data,in the send function's end it reveive data.For the client,when it receives data,in the receive function's end it sends data.Wether I have some misunderstanding TCP/IP protocal?Thank you very much!