How can i change the IP in run time

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How can i change the IP in run time

2,100件の閲覧回数
faustino
Contributor I

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.

ラベル(1)
0 件の賞賛
返信
4 返答(返信)

1,135件の閲覧回数
bkatt
Contributor IV

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.

 

0 件の賞賛
返信

1,135件の閲覧回数
MCF52233
Contributor III

 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.

 

 

 

 

 

 

 

 

0 件の賞賛
返信

1,135件の閲覧回数
mjbcswitzerland
Specialist V

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..."

 

0 件の賞賛
返信

1,135件の閲覧回数
PaoloRenzo
Contributor V
Why resetting is not an option? Have you considered software reset? Using CF registers, a software reset is different from a hardware reset, you firmware can handle both events indepently at start-up
0 件の賞賛
返信