Re: IOCP and WSASend

From: Isaiass (isaiass_at_hotmail.com)
Date: 11/04/04


Date: Thu, 4 Nov 2004 11:03:45 -0300

You should NOT process anything just after the function call in case of
success, only at GQCS...

What you should to check is whether the function has queued packet
successfully or it has failed:

if (WSASend(socket, ...) == SOCKET_ERROR) {
 dwErr = WSAGetLastError();
 if (dwErr != WSA_IO_PENDING) {
  printf("WSASend failed for sock #%d with error code #%d\n", socket,
dwErr);
  CleanUp(...); // close the socket and free all allocated resources
  break; // continue, return etc
 }
}

Isaiass

"Konstantin Knyazev" <kknyazev_no_spam_@mail.ru> wrote in message
news:eQiv%23AlwEHA.4040@TK2MSFTNGP11.phx.gbl...
> Hi!
>
> I'm using IOCP and WSASend to send data. But i'm a little confised, when i
> invoke WSASend i recieve result 0, i mean that data is sent and close
socket
> and free client resources, but on next GetQueuedCompletionStatus i'm
> recieving message about sending complete of closed socket and error raised
> due a client's data freed. Please, help me understand how to use WSASend
> when it return 0. I have not found any information about it in MSDN.
Thanks!
>
> Best regards, Konstantin Knyazev
>
>



Relevant Pages

  • Re: IOCP question: ordering of data
    ... WSASend will never return with a partial ... Microsoft MVP, MCSD ... If multiple iocp-worker threads are used, ... My understanding is that if I issue only ONE WSASend on one socket, ...
    (microsoft.public.win32.programmer.networks)
  • Re: IOCP question: ordering of data
    ... A good example of such is iocp sample in PSDK which use additional ... WSASend will never return with a partial ... If multiple iocp-worker threads are used, ... My understanding is that if I issue only ONE WSASend on one socket, ...
    (microsoft.public.win32.programmer.networks)
  • Re: Question regarding completion routine on overlapped WSASend
    ... Due to my experience you can set Competion routine pointer to NULL, ... socket sent all data you specifed in WSASend ... I realize if WSASend returns 0 ...
    (microsoft.public.win32.programmer.networks)
  • Re: IOCP question: ordering of data
    ... in theory WSASend can do partial writes for blocking ... Microsoft MVP, MCSD ... If multiple iocp-worker threads are used, ... My understanding is that if I issue only ONE WSASend on one socket, ...
    (microsoft.public.win32.programmer.networks)
  • Re: Did WSASend always returned SOCKET_ERROR and error code is WSA_IO_PENDING .. ??
    ... Even for non-overlapped operations successful return value of send bytes ... Overlapped Socket I/O ... If an overlapped operation completes immediately, WSASend returns a value ... I set the SO_SNDBUF zero. ...
    (microsoft.public.win32.programmer.networks)