Chat freely about anything...

User avatar
By wchpikus
#71676
eriksl wrote:The clients send data to the server, the other way around, or in both directions?

And then when a client is reset three times or more, the complete UART on the server stops? You can still connect to the server?


When i reset the client more than 3 times, i got only ip.
No possibility to recive and send data to socket.
Uart works ok.

My scheme is:
One client ( windows telnet) wathing data from uart.
Second client sending something via tcp to uart and recive data from uart (from server).
Now i reset client and after 3 or more time i got only ip address and nothing ( no data from server).
I must restart server and connect again.
It is look like server still keep connection and socket open and has no resorce to create new?
User avatar
By eriksl
#71677 When that has happend, can you still ping the ESP server and can you send commands (telnet to port 24)?

You can only have one connection, one client and one server at a time. It's not an out of resources issue, but a code complexity consideration. More simultanuous sockets would mean more RAM usage and that is quite limited.

A new connection can only be made when the previous connection has closed. If the client is reset, it can't close the connection properly and the server may not know the connection was closed, there is some timeout that needs to be observed. And you may end up in this situation.

If you want stateless communication, use udp instead. The server will send it's data to whatever IP address it received some data from the last time. No timeouts.
User avatar
By wchpikus
#71678
eriksl wrote:When that has happend, can you still ping the ESP server and can you send commands (telnet to port 24)?

You can only have one connection, one client and one server at a time. It's not an out of resources issue, but a code complexity consideration. More simultanuous sockets would mean more RAM usage and that is quite limited.

A new connection can only be made when the previous connection has closed. If the client is reset, it can't close the connection properly and the server may not know the connection was closed, there is some timeout that needs to be observed. And you may end up in this situation.

If you want stateless communication, use udp instead. The server will send it's data to whatever IP address it received some data from the last time. No timeouts.



For test i bought hlk-rm04.
This wifi brigde works well,no problem with my clients, but price is a bit high.
And bootup time about 40s.
I thing esp has week tcpip stack,do you use orginal tcpip stack or arduino?
User avatar
By eriksl
#71679 I have nothing to do with arduino. I am using the IP implementation from Espressif, that means 99% LWIP and 1% from Espressif itself. Because of it's small RAM, the IP implementation is limited.

And as I said before, if you reset a device without closing the socket properly, the other end of the socket will keep waiting for the socket to become closed for some time until it timeouts. So either don't reset but close the socket properly or use UDP, which is designed for that use.