【发布时间】:2017-09-05 12:27:03
【问题描述】:
假设我有一个消息队列,例如std::deque<std::vector<uint8_t>>()
我做了一个poll()(或选择),并且知道套接字已准备好写入。
我愿意:
const auto& message = _messageQueue.front();
_socket.sendBytes(message.data(), message.size());
_messageQueue.pop_front();
例如,我可以断言发送的字节数与消息大小相同,但 Poco 文档说 StreamSocket::sendBytes()
Returns the number of bytes sent, which may be less than the number of bytes specified.
Poco 文档也没有说明 setBlocking() 方法的实际作用。它会阻塞直到收到 ACK 数据包,并抛出套接字错误?
【问题讨论】:
标签: c++ sockets poco-libraries