bool AbstractSocket::send(void *data, const size_t &size)
{
ssize_t result = ::send(m_sfd, data, size, MSG_WAITALL);
if (result == -1 ) {
if (errno != EAGAIN) {
LOG_ERR("failed to write socket")
emitErrorSignal();
} else { // else If errno == EAGAIN
// that means we have read all data.
return true;
}
} else if (result == 0) {
// The remote has closed the connection
LOG_WNG("the remote has closed the connection")
emitErrorSignal(std::errc::connection_aborted);
}
return size == static_cast<size_t>(result);
}
我正在尝试创建具有指定大小的发送函数,该函数发送所有数据。为什么send
引发EINVAL
错误?什么参数无效?
什么参数无效?
send
功能没有MSG_WAITALL
选项。因此MSG_WAITALL
无效。
send
仅支持: