R
Rob.J.White
I've written a windows shell that is controlled from and reports to a
network based management system. As such communication with the network
must be ensured. The problem I have is that I'm working on a DHCP
network and in some cases it is possible that my shell has loaded and
bound to a local address before DHCP has responded. In this instance
the IP address changes and my sockets no longer receive data.
As an intermediary measure I have constructed a thread that monitors
the IP address of the adapters and if they change it restarts the
networked side of my application. This seems a bit like a kludge;
surely this is something that people must come up against all the time,
for instance writers of windows services must have to take this into
account not only for start up, but also when a user does something like
ipconfig /renew, which could very well change the IP. Is there an
elegant way of doing what I'm trying to do, or indeed is there a way
that I can bind a socket to a physical adapter and not an IP address?
Oh and I'm working in C#, but if someone has a compelling reason to
switch to native code I'm game.
Any thoughts or theories would be greatly appreciated.
Rob
network based management system. As such communication with the network
must be ensured. The problem I have is that I'm working on a DHCP
network and in some cases it is possible that my shell has loaded and
bound to a local address before DHCP has responded. In this instance
the IP address changes and my sockets no longer receive data.
As an intermediary measure I have constructed a thread that monitors
the IP address of the adapters and if they change it restarts the
networked side of my application. This seems a bit like a kludge;
surely this is something that people must come up against all the time,
for instance writers of windows services must have to take this into
account not only for start up, but also when a user does something like
ipconfig /renew, which could very well change the IP. Is there an
elegant way of doing what I'm trying to do, or indeed is there a way
that I can bind a socket to a physical adapter and not an IP address?
Oh and I'm working in C#, but if someone has a compelling reason to
switch to native code I'm game.
Any thoughts or theories would be greatly appreciated.
Rob