I am trying to develop a chat between 2 nodeMCU's.
So far I've been able to communicate between them in my home network because I know both of the ip address.
The thing is that I need to do the following sequence:
First: The client nodeMCU connects to the server nodeMCU via the server's AP (server is working in dual mode, AP_STA). At this point since the client connected to the AP the server can have a fixed ip address previously set. So no problem until here.
Second: The client (which can be connected to the pc to upload the following info) sends the home network information to the server (SSID and pass). Once this is done the server can stay connected to the home network
Third: Now the client disconnects from the server's AP and connects to the home network. but there is a problem, it does not know the ip address of the server in the home network, since the router may change it dynamically.
Setting a static ip is not an option.
Can I search for all the devices connected in the network and maybe check if any of them has the same MAC as the server nodemcu and then connect to that ip? Or maybe something like that. I am kind of stuck here, I will appreciate any help!