السلام عليكم
كنت ابحث في الانترنت تحديداً في الرابط :
http://msdn.microsoft.com/library/default...._start_page.asp
فوجدت الموضوع :
Receiving Notification of Network Events Use the following functions to ensure that an application receives notification of certain network events. Use the NotifyAddrChange function to request notification of any change that occurs in the mapping between IP addresses and interfaces on the local computer. Similarly, the NotifyRouteChange function enables an application to request notification of any change that occurs in the IP routing table. The notifications provided by these functions do not specify what changed; they simply specify that something changed. Use other IP Helper functions, such as GetIPAddrTable and GetBestRoute, to determine the exact nature of the change.
1 - فهل الدالة NotifyAddrChange تجعل الشبكة تزودك بحدث كلما تغير عنوان الأيبي ؟
2 - حبذا لو تفضل أحد بشرح الدوال المستخدمه في البرنامج التالي (مع التفصيل الممل فأنا مبتدئ C++) :
#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");
}المصدر
http://msdn.microsoft.com/library/default....yaddrchange.asp
وشكراً لكم مقدماً .
والسلام عليكم