473,396 Members | 1,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 8963
Yes, but it will require some PInvoke calls, the core API to call is NotifyAddrChange (iphlpapi.dll), please consult the IP HELPER
docs (platform SDK) for more info .

Willy.

"roger beniot" <ro**********@yahoo.com> wrote in message news:6c**************************@posting.google.c om...
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 ManagementObject) to query for
the DefaultIPGateway 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**************@TK2MSFTNGP12.phx.gbl>...
Yes, but it will require some PInvoke calls, the core API to call is NotifyAddrChange (iphlpapi.dll), please consult the IP HELPER
docs (platform SDK) for more info .

Willy.

"roger beniot" <ro**********@yahoo.com> wrote in message news:6c**************************@posting.google.c om...
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**********@yahoo.com> wrote in message
news:6c*************************@posting.google.co m...
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 ManagementObject) to query for
the DefaultIPGateway 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**************@TK2MSFTNGP12.phx.gbl>...
Yes, but it will require some PInvoke calls, the core API to call is NotifyAddrChange (iphlpapi.dll), please consult the IP HELPER
docs (platform SDK) for more info .

Willy.

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

news:6c**************************@posting.google.c om...
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
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: ...
8
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 ;)). ...
8
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: ...
6
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. ...
4
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> ...
1
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...
2
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...
2
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...
2
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.