i have the problem, when i work with several sockets.
This is the debug of my AT-Parser (This is not the RAW communication on the uart, but if you don't trust it, i will record it later:
Code: Select all
// I announce to send 1336 Bytes to socket 0
10:44:58 [ESP8266 ] AT CMD[AT+CIPSEND=0,1336] STATEOK[0x81] STATEERR[0x83] TIMEOUT[15000ms]
10:44:58 [ESP8266 ] [TX] LEN[19]
// Esp accept my request
10:44:58 [ESP8266 ] [RX] Response received LEN[2]
10:44:58 [ESP8266 ] OK
// Esp asked for the data
10:44:58 [ESP8266 ] Data-Request received
10:44:58 [ESP8266 ] New State OLD[0x50] NEW[0x81]
// I transmit 1336 Bytes
10:44:58 [ESP8266 ] [TX] LEN[1336]
// Esp confirms, that it received 1136 Bytes
10:44:58 [ESP8266 ] [RX] Response received LEN[15]
10:44:58 [ESP8266 ] Recv 1336 bytes
// Esp send me 3872 Bytes, which cames from
10:44:58 [ESP8266 ] Data received SOCKET[4], LENGTH[1452]
10:44:58 [ESP8266 ] Data received SOCKET[4], LENGTH[1452]
10:44:59 [ESP8266 ] Data received SOCKET[4], LENGTH[968]
10:44:59 [ESP8266 ] [RX] Response received LEN[8]
// The client an Socket 4 closed the connection
10:44:59 [ESP8266 ] 4,CLOSED
10:44:59 [ESP8266 ] Client disconnected! SOCKET[4]
10:44:59 [ESP8266 ] New socket state SOCKET[4] OLD[1] NEW[0]
// Esp tells me, that it could not send my last 1336 bytes to socket 0 ?!
10:44:59 [ESP8266 ] [RX] Response received LEN[9]
10:44:59 [ESP8266 ] SEND FAIL
10:44:59 [ESP8266 ] Failed! RESPONSE[SEND FAIL] STATE[0x81] OK[0x82] ERR[0x83]
10:44:59 [ESP8266 ] New State OLD[0x81] NEW[0x83]
10:44:59 [ESP8266 ] New State OLD[0x83] NEW[0x84]
// For recovering purpose, i send an "AT" command, to ensure, that i'm in sync with the AT-Interpreter of the Esp
10:44:59 [ESP8266 ] AT CMD[AT] STATEOK[0x50] STATEERR[0x84] TIMEOUT[50ms]
10:44:59 [ESP8266 ] [TX] LEN[4]
// Now, i receive an answer, that the data were sent successfully! - But i already give it up, due to the privously "SEND FAIL", in fact: the data reached the receiver.
10:44:59 [ESP8266 ] [RX] Response received LEN[7]
10:44:59 [ESP8266 ] SEND OK
10:44:59 [ESP8266 ] Ignored[SEND OK]!
// Esp answered with an OK to my last AT-Request.
10:44:59 [ESP8266 ] [RX] Response received LEN[2]
10:44:59 [ESP8266 ] OK
The problem is reproducable. When i receive TCP Data on one socket, during a Send, i got the message "SEND FAIL" first, and a few ms. later the message "SEND OK".
Is this a bug in the AT-Firmware? - What can i do to fix the problem?
With my current implementation, i transfer the failed package a second time. As a result, this package arrives twice times at the receiver.
Thank you for your support!