WSARecvFrom : Receive data into multiple buffers

  • Thread starter Thread starter Z. V
  • Start date Start date
Z

Z. V

Guest
Hello,

I'm using the following code in order to receive N_BUF UDP messages, each will be received to a different pointer.

#define N_BUF 6
WSABUF DataBuf[N_BUF];
char RecvBuf[BUF_LEN * N_BUF];

for (int i=0;i<N_BUF;i++)
{
DataBuf.len = BufLen;
DataBuf.buf = &RecvBuf[i*BUF_LEN];
}

rc = WSARecvFrom(RecvSocket,
DataBuf,
N_BUF,
NULL,
&Flags,
(SOCKADDR *)& SenderAddr,
&SenderAddrSize, &Overlapped, NULL);



Then I want to call WaitForSingleObject N_BUF times.

Is this the right way ?

Thank you,
Zvika

Continue reading...
 
Back
Top