So, now I got the board and get well over Wifi to connect to my phone.
But when I'm out there without Wifi, how do I get a connection to the phone if I do not know the IP?
First of all thanks for your answer.
The board should be itself a wireless server. I must be able to connect with different devices (Android and iOS) and exchange data.
With this example, I configured the board as a server, but I know now not how to exchange data with different devices.
The ESP module and the phone must be connected to the same network for them to communicate. You can connect the phone to the ESP ad hoc network. The ESP8266 ip address will be: 192.168.4.1
WiFiServerSocket supports a single connection only.
You can create several instances and listen to different ports.
Another simpler option is to use MQTT or WebSockets. You will need to run a server but it will allow you to connect multiple devices easily. You can use a Raspberry Pi as the server (or an Android device).
You can start by using one port, keeping it in a variable and then, upon a successful connection, create a new listener on another port!
Also, to liberate used ports, check if a port is not used for a while, like a few hours, and if so, re-initialize it!
Dear Filippo,
I tried to create multiple instances of sever (server1, server2...), as per the above post . Created different
Server_NewConnection subs , but my WeMos crashes ! If you have succeeded in creating multiple servers (sharing the same data), please let me know the initialisation and other required subs.
regards,