Re: NotifyAddrChange()
- From: "Alexander Nickolov" <agnickolov@xxxxxxxx>
- Date: Thu, 13 Jul 2006 11:14:43 -0700
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
.
- References:
- NotifyAddrChange()
- From: netmon
- NotifyAddrChange()
- Prev by Date: Re: Finding bluetooth devices in a range
- Next by Date: Re: Why NetUserGetInfo does not give me the users home directory
- Previous by thread: NotifyAddrChange()
- Next by thread: Re: NotifyAddrChange()
- Index(es):
Relevant Pages
|
|