Re: NotifyAddrChange()



Well, it's a sample... Sample code should never make its way
into production code. In this particular case the sample exits
right away so any leaks will be reclaimed by the OS right away.
You can copy the code in your test and fix the leaks yourself.

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@xxxxxxxx
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================

"netmon" <shawnberg@xxxxxxxxx> wrote in message
news:1152805238.179671.282580@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I don't understand why the NotifyAddrChange() sample code doesn't
cleanup up the events that are created. I want to put this sample code
in a loop to stress a DCHP server without leaking handles:

#include <winsock2.h>
#include <windows.h>
#include <iphlpapi.h>
#include <stdio.h>

void main()
{
OVERLAPPED overlap;
DWORD ret;

HANDLE hand = WSACreateEvent();
overlap.hEvent = WSACreateEvent();

ret = NotifyAddrChange(&hand, &overlap);

if (ret != NO_ERROR)
{
if (WSAGetLastError() != WSA_IO_PENDING)
{
printf("NotifyAddrChange error...%d\n", WSAGetLastError());
return;
}
}

if ( WaitForSingleObject(overlap.hEvent, INFINITE) == WAIT_OBJECT_0 )
printf("IP Address table changed..\n");
}

Thanks



.



Relevant Pages

  • NotifyAddrChange()
    ... I don't understand why the NotifyAddrChangesample code doesn't ... in a loop to stress a DCHP server without leaking handles: ... OVERLAPPED overlap; ... DWORD ret; ...
    (microsoft.public.win32.programmer.networks)
  • Re: Sample code to disconect and remove all the filters from a FG
    ... I would prefer to just kill of the graph and start over but this leaks memory. ... So I though if there is any one in the world looking to disconnect their graph, here looked like a way to do it. ... Again there was no sample code, and DirectShow could use more of it so I though I'd post. ...
    (microsoft.public.win32.programmer.directx.video)