I would like to read a analoge sensor connected to a ESP32 on my smartphone.
I would write an anaolge output on the same ESP as well with my smartphone.
Is there anywhere an example because the examples I found closes the client (client.stop();) constantly, so there is no online update of the value's possible.
This whitin my home Wifi network.
Actually, we might get better results by leveraging the ESP32’s BLE capabilities directly. Emulating a serial port can be a bit hit-or-miss, whereas the native protocol is the standard way to handle this.
Both of these boards support BLE and classic bluetooth. So, you can use serial bluetooth terminal app or you can follow [cotestatnt]'s (Profile - cotestatnt - Arduino Forum) instructions. Either way you can solve your purpose.
you could run an access point and webserver on the ESP32
the ESP32 could read the senor and display the data on the web page using server-sent-events
a smartphone/laptop etc could connect to the access point SSID and run a web client to view the webpage