473,659 Members | 3,553 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting notified of IP address change?

I would like to figure out how to detect an IP address change for an
XP/Win2K3 machine that is leasing an IP via DHCP (and do it in C#)...

Is there any event that indicates an IP address change?... I really
don't want to poll for a change.

I would like to get an event indicating the IP address has changed and
propogate that change to other levels of my app.

If anyone has a solution that isn't in C# I am interested in that as
well (but I would really like to know if it is possible in C#).

Thanks in advance,
Roger
Nov 15 '05 #1
3 8976
Yes, but it will require some PInvoke calls, the core API to call is NotifyAddrChang e (iphlpapi.dll), please consult the IP HELPER
docs (platform SDK) for more info .

Willy.

"roger beniot" <ro**********@y ahoo.com> wrote in message news:6c******** *************** ***@posting.goo gle.com...
I would like to figure out how to detect an IP address change for an
XP/Win2K3 machine that is leasing an IP via DHCP (and do it in C#)...

Is there any event that indicates an IP address change?... I really
don't want to poll for a change.

I would like to get an event indicating the IP address has changed and
propogate that change to other levels of my app.

If anyone has a solution that isn't in C# I am interested in that as
well (but I would really like to know if it is possible in C#).

Thanks in advance,
Roger

Nov 15 '05 #2
Good stuff thanks Willy... So that covers the case when a machine,
connected to the same network as the dhcp server, gets a newly
assigned IP address...

Now how about the case when you have a LAN that is behind a Gateway
and the gateway has a leased IP address... Is there a way to figure
out if the gateways ip address has changed (besides polling).

I have used the WMI stuff (specifically ManagementObjec t) to query for
the DefaultIPGatewa y successfully, but now my only option seems to
keep polling the field for a change.

thanks in advance,
roger

"Willy Denoyette [MVP]" <wi************ *@pandora.be> wrote in message news:<ON******* *******@TK2MSFT NGP12.phx.gbl>. ..
Yes, but it will require some PInvoke calls, the core API to call is NotifyAddrChang e (iphlpapi.dll), please consult the IP HELPER
docs (platform SDK) for more info .

Willy.

"roger beniot" <ro**********@y ahoo.com> wrote in message news:6c******** *************** ***@posting.goo gle.com...
I would like to figure out how to detect an IP address change for an
XP/Win2K3 machine that is leasing an IP via DHCP (and do it in C#)...

Is there any event that indicates an IP address change?... I really
don't want to poll for a change.

I would like to get an event indicating the IP address has changed and
propogate that change to other levels of my app.

If anyone has a solution that isn't in C# I am interested in that as
well (but I would really like to know if it is possible in C#).

Thanks in advance,
Roger

Nov 15 '05 #3
Create a .net remoting service on the gateway that uses the pinvoke to get
the ip update as Willy said. Then, that service can notify any client with
..NET using events or a remoting host on the client, etc. No polling needed.
Just curious, why would the clients need to be notified of the gateway
change? If for public host address, then just have the service above,
change the DNS host record after the pinvoke event, then clients should pick
up the new IP after TTL.

--
William Stacey, MVP

"roger beniot" <ro**********@y ahoo.com> wrote in message
news:6c******** *************** **@posting.goog le.com...
Good stuff thanks Willy... So that covers the case when a machine,
connected to the same network as the dhcp server, gets a newly
assigned IP address...

Now how about the case when you have a LAN that is behind a Gateway
and the gateway has a leased IP address... Is there a way to figure
out if the gateways ip address has changed (besides polling).

I have used the WMI stuff (specifically ManagementObjec t) to query for
the DefaultIPGatewa y successfully, but now my only option seems to
keep polling the field for a change.

thanks in advance,
roger

"Willy Denoyette [MVP]" <wi************ *@pandora.be> wrote in message

news:<ON******* *******@TK2MSFT NGP12.phx.gbl>. ..
Yes, but it will require some PInvoke calls, the core API to call is NotifyAddrChang e (iphlpapi.dll), please consult the IP HELPER
docs (platform SDK) for more info .

Willy.

"roger beniot" <ro**********@y ahoo.com> wrote in message

news:6c******** *************** ***@posting.goo gle.com...
I would like to figure out how to detect an IP address change for an
XP/Win2K3 machine that is leasing an IP via DHCP (and do it in C#)...

Is there any event that indicates an IP address change?... I really
don't want to poll for a change.

I would like to get an event indicating the IP address has changed and
propogate that change to other levels of my app.

If anyone has a solution that isn't in C# I am interested in that as
well (but I would really like to know if it is possible in C#).

Thanks in advance,
Roger

Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

80
5241
by: Bibby | last post by:
Hi, I'm interested in getting started in the programming world. I've dabbled in C, C++ and VB6. Which would be the best language to focus my attention to regarding the following considerations: Hireability Portability Flexibility The likely candidates seem to be Java, VB.Net, C, C++, C#.
8
8940
by: Timo | last post by:
I am trying to get address of myStruct to a string array texts. I am using M$ Visual C++ 6.0 (this is not OS specific question, though, this code should also work on 16 bit embedded compiler ;)). This is my code: typedef struct { const unsigned short a; const unsigned long b;
8
1185
by: AC | last post by:
I have a Spanish page that contains a link to send an email (one of those "send this page to someone"). The Hyperlink uses the MailTo:?subject=something format. It' looks like tihs: href="mailto:?body=Encontré una página en el sitio But when the user clicks on the link, they see this in the email body: Encontré una página en el sitio It's translating the Spanish characters. I haven't worked much with multilingual sites. No matter...
6
2359
by: sylcheung | last post by:
Hi, How can I be notified when the document load is complet in JavaScript? I am referring to the whold document load is complete, mean all images/external files/frame/iframes have been loaded. I think there is a window.addEventListener() function but I am not sure which event to listen to. Thank you.
4
6296
by: andreas.w.h.k. :-\) | last post by:
How do I change the address location in the wsdl <wsdl:port name="SearchSoap12" binding="tns:SearchSoap12"> <soap12:address location="http://searchservices/engine/search.asmx" /> </wsdl:port> Anderas
1
1218
by: VG | last post by:
Hi, I want to hookup some database change events automatically to my .NET application. The backend is SQLServer 2003. Is this possible? How do I get notified automatically of changes in my database? Samples and URLs would help.
2
5992
by: Sin Jeong-hun | last post by:
My application displays today's date on the form like; Friday August 4, 2006 This information is determined at the form's constructor. But what about the user has kept the form shown so long that the next day comes ( in this case, Saturday August 5, 2006)? One simple way is to check the today's date periodically and if the date has been changed, then update the date on the form. But this seems to be a waste. If the interval is short,...
2
1234
by: active | last post by:
I think I saw something once that made me think a program could get notified if a file changes. I'm not sure if the notification occurs if anything in the file system changes or if it is more selective. I've been searching the VS2005 doc but can't find anything. In any event, is there a way my app could be notified if a particular or if any file changes?
2
3566
by: rustyc | last post by:
Well, here's my first post in this forum (other than saying 'HI' over in the hi forum ;-) As I said over there: ... for a little side project at home, I'm writing a ham radio web site in uby/Rails. I started it in Perl and gave up on Perl as I went from the 'display the database information on the web page' to the 're-display the information from the database and allow the user to update the database using the web page' stage and realized...
0
8337
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8748
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8531
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7359
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6181
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2754
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1739
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.