cancel
Showing results for 
Search instead for 
Did you mean: 

How to change the IP Address at runtime

VSomasekhar
Associate II

This is my Environment:
Microcontroller: STM32H723ZET6
LWIP is used. No RTOS used.
I am setting a Static IP address in the *.ioc file. I am setting the same IP address in the TCP Raw Socket Echo Server to Bind the socket. Over that I am running the Modbus Server. DHCP is disabled. 
I want to change the IP Address at run-time. How is it possible?

2 REPLIES 2
Andrew Neil
Evangelist III

@VSomasekhar wrote:

I want to change the IP Address at run-time. How is it possible?


Use DHCP.

Provide an interface so that the user can provide the (static) IP address.

ASEHST
ST Employee

Hello,

To change the IP address, please try disabling the network interface. Next, use netif_set_addr to set the new IP address, subnet mask, and gateway. Finally, re-enable the interface to apply the new configurations.

 

With Regards,

If your question is answered, please close this topic by clicking "Accept as Solution".