Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要使用 QtNetwork 关闭 TCP 套接字的写入端(发送 FIN)。
对于 BSD 套接字,我会调用 shutdown(..., SHUT_WR)。
我如何使用 QtNetwork API 做到这一点?
从文档
void QIODevice::setOpenMode(QIODevice::ReadOnly)
应该有帮助:
void QIODevice::setOpenMode(OpenMode openMode) [protected] Sets the OpenMode of the device to openMode. Call this function to set the open mode if the flags change after the device has been opened.