tcpserver的读取槽函数如下:
recBuffer.append(tcpSocket->readAll());///>缓存接收的数据
tcpSocket->flush();
我在此处写了一个调用了一下flush函数,但是这个是没有必要的,试看官方文档描述如下:
This function writes as much as possible from the internal write buffer to the underlying network socket, without blocking. If any data was written, this function returns true; otherwise false is returned.
Call this function if you need QAbstractSocket to start sending buffered data immediately. The number of bytes successfully written depends on the operating system. In most cases, you do not need to call this function, because QAbstractSocket will start sending data automatically once control goes back to the event loop. In the absence of an event loop, call waitForBytesW