我正在使用 std::vector 来表示每个 IO 数据结构中的缓冲区:
struct PerIoData
{
WSAOVERLAPPED m_overlapped;
SOCKET m_socket;
WSABUF m_wsaBuf;
std::vector<BYTE> m_vecBuffer;
DWORD m_dwFlags;
DWORD m_dwNumberOfBytesSent;
DWORD m_dwNumberOfBytesToSend;
eOperationType m_operationType;
};
...
...
if (WSARecv(pPerIoData->m_socket, &(pPerIoData->m_wsaBuf), 1, &dwNumberOfBytesReceived, &(pPerIoData->m_dwFlags), &(pPerIoData->m_overlapped), NULL) == 0)
continue;
我想在调用 WSARecv() 后指定最大大小并在 m_vecBuffer 上执行“缩小以适应”。
我已经查看了此页面,但无法找到我正在寻找的信息。