Re: Question regarding completion routine on overlapped WSASend



Due to my experience you can set Competion routine pointer to NULL, but
overlapped pointer have to be set for non-blocked sockets, otoh you can't
free ovelapped struct unless you'll receive in completion routine that
socket sent all data you specifed in WSASend
Arkady


"Mark" <Mark@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:3EBA0266-F62D-49A2-A613-00A03CB5243E@xxxxxxxxxxxxxxxx
Hello all,

I have the following

void CALLBACK CompletionROUTINE(...) {
...
}

// send using overlapped blocking socket
WSASend(socket, pbuf, 1, &sent, flags,
lpOverlapped, CompletionROUTINE);

From experiment, I realize if WSASend returns 0
(completes immediately), then CompletionROUTINE
is not called, that's ok.

What I want to know is if indeed CompletionROUTINE
is called:

1. is the lpOverlapped parameter passed to the
completion routine the exact same address as the
one I passed to WSASend (in other words, can I new
a WSAOVERDLAPPE struct and pass it to WSASend,
and then delete it inside the completion routine??)

2. what if I pass 0 as lpOverlapped to WSASend,
what would be passed as lpOverlapped to
CompletionROUTINE()??

Thanks, I can't figure this out out of the help page
and appreciate an answer from anybody who has experience
in using overlapped sends.






.



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: IOCP
    ... At the moment, when a socket closes properly, I have the completion routine ... socket - if the connection is lost you should not get WSAENOTSOCK. ...
    (microsoft.public.win32.programmer.kernel)
  • 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)

Quantcast