Hello nine sun,
I apologize for my late response.
When you open socket on specific address and port, it´s clear that you cannot change it while it running.
First you must close the socket, configure new IP address and then open the socket.
Best Regards,
Iva