c++ - GetOverlappedResults blocks with bWait = false -



c++ - GetOverlappedResults blocks with bWait = false -

getoverlappedresults() not homecoming @ all. ran simple illustration bellow , when there ip address alter in network interface manual reset event gets set , can see "ip address table changed.." output, getoverlappedresults() not homecoming though bwait false. bwait = true should homecoming because event set hence i/o operation complete.

what going on?

#include <winsock2.h> #include <iphlpapi.h> #include <stdio.h> #include <windows.h> #pragma comment(lib, "iphlpapi.lib") #pragma comment(lib, "ws2_32.lib") void main() { overlapped overlap; dword ret, nr; handle hand = null; overlap.hevent = createevent(null, true, false, null); ret = notifyaddrchange(&hand, &overlap); (;;) { if ( waitforsingleobject(overlap.hevent, infinite) == wait_object_0 ) { printf("ip address table changed..\n"); ret = getoverlappedresult(hand, &overlap, &nr, false); scanf_s("%d %d\n", ret, nr); printf("done\n"); notifyaddrchange(&hand, &overlap); resetevent(overlap.hevent); } } }

the wait caused scanf_s(). guess meant printf homecoming value not read it.

c++ asynchronous overlapped-io

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -