-->
Page 1 of 1

How leave connection open if ESP8266 is the server?

PostPosted: Sat Nov 26, 2016 9:53 am
by Frizie
Hi Richard.


It must for the users of my app(s) be very simple to connect to the ESP8266 by looking in the Wifi-list from their smartphone and select and click "ESP8266" (or "Ai-thinker ESP-01", or whatever).
Thats why the ESP8266 should be the server and the smartphone the client.

CWMODE_DEF=3
CIPMUX=1
CIPSERVER=1,8888

Now, my app can connect to the ESP8266 (with external microcontroller) by simple select and click "ESP8266" in the Wifi-list from the smartphone.
I can send messages from the smartphone to the ESP8266 (my app doesn't close the connection(!), because I want to leave the connection open).

So far, so good.

But if the microcontroller sends a message back (via the ESP8266) to the smartphone, the ESP8266 sends first the message, than SEND OK (or SEND FAIL) and then close the connection!
This is not what I want, it shouldn't close the connection!
Because how can I send a next message?


CIPMUX=0 (single connection) is not an alternative, because then the ESP8266 can not be the server, and I want to have the benefits of having the ESP8266 as the server (but only then with max. one client).
A big benefit when the ESP8266 is the server is (as I described), that the user can select the connection in the Wifi-list from his phone, click, ready!
An easy way to connect to the ESP8266 for computer illiterate people.

There should be (come) an option (parameter) in the ESP8266 that it let it's connection open if it is the server (ofcourse the ESP8266 should accept then only max. 1 client).
Then you still have the TCP protocol but gives the ESP8266 an extra option above others!

Or is there another way?


Best regards.
Frizie - Raalte.