Hi all
I am using M52233 demo board with Coldfire lite stack and the web server, but I want to know how can I change the ip adress in run time. For example, if I write into the LCD the IP adress and use that adress without have to restar the micro.
thanks and excusme for my bad english.
faustino wrote:
I am using M52233 demo board with Coldfire lite stack and the web server, but I want to know how can I change the ip adress in run time.
Just follow what the Niche code already does in set_ipaddr() (NRMENUS.C) or dhc_setip() (DHCPCLNT.C). The DHCPCLNT.C code is a little smarter about setting the mask, default gateway, and broadcast addresses.
There's a warning about "setip will kill all current net connections!" but it is overstated. Changing the IP will make any connected TCP sockets unreachable. You may want to take action to close them before the change.
The local ARP table is not affected by this change, as it tracks IP addresses of other hosts. Those other hosts may have copies of your previous IP address in their ARP tables, which will eventually expire.
Hi,
definately reset is good option becoz consider a scenario where communicarion is going on
with microcontroller n suddenly u change d IP but arp entries are associated with the previous
IP address. When u reset then there is communication drop n arp entries get changed.
Hi
On-the-fly IP changes are used quite often in the uTasker project so generally it should not be a real difficulty. When the new IP settings are committed, the ARP table is flushed and so there is an orderly change.
Regards
Mark
www.uTasker.com
- OS, TCP/IP stack, USB, device drivers and simulator for M521X, M521XX, M5221X, M5222X, M5223X, M5225X. One package does them all - "Embedding it better..."