[Libevent-users] GetQueuedCompletionStatus return values question/problem

Kevin Sanders newroswell at gmail.com
Wed Nov 1 11:39:09 EST 2006


On 11/1/06, Kevin Sanders <newroswell at gmail.com> wrote:
> On 11/1/06, Toby Douglass <toby.douglass at summerblue.net> wrote:
> > Kevin Sanders wrote:
> > >> Now, the problem is this: ERROR_SUCCESS is #defined as zero!
> > >>
> > >> In other words, I don't think it's possible to differentiate between
> > >> case 3 and 4, because in case 3, *lpNumberOfBytes might be 0 just by
> > >> chance.
> >
> > > Call GetLastError().
> >
> > I could be wrong, but I don't think that helps you, because you would
> > have to know the full list of possible errors for both cases, so that
> > you could be certain that you were correctly differentiating between them.
> >
> > I have no idea what errors either cases might return, nor any idea of
> > where to look to find the full list of possible errors for both cases
> > and indeed I suspect that information is not documented.
>
> In case 3, GetLastError will not be 0, in case 4, GetLastError will be 0.
>

Something else that might be bitting you here; you should be setting
*lpNumberOfBytes = 0 before calling GetQueuedCompletionStatus.  That
way, on exit, if you have *lpNumberOfBytes == 0, you either have a
closed remote socket (GetLastError() == 0), or some error
(GetLastError() != 0).

GetQueuedCompletionStatus doesn't randomize the lpNumberOfBytes in
case of error, it just doesn't change it from what you set it to.


More information about the Libevent-users mailing list