Chat freely about anything...

User avatar
By Bummibaer
#35139 Hello,

I have the logic:
Code: Select allinit() {
....
  rc = espconn_set_opt (conn, ESPCONN_COPY); // enable write buffer
...
}
espbuffsent (serverConnData *conn, const char *data, uint16 len) {
...
      if (conn->readytosend)
   {
     LOG('S');LOG(0);
     rc = sendtxbuffer (conn);
   }
      else
   {
     LOG('N');
      }
}
sendtxbuffer (serverConnData *conn)
{
  if (conn->txbufferlen != 0)
    {
      conn->readytosend = false;
     result = espconn_send (conn->conn, (uint8_t*) conn->txbuffer, conn->txbufferlen);
      if (result == ESPCONN_OK)
   {
     conn->txbufferlen = 0;
   }
}
user_tcp_write_finish (void *arg)
{
  LOG('F');

  serverConnData *conn = serverFindConnData (arg);
  conn->readytosend = true;
  LOG('s');
  if (conn->txbufferlen > 0)
    {
      sendtxbuffer (conn); // send possible new data in txbuffer
    }

}


It works for some Frames, but then I get a Error
ESPCONN_MAXNUM from espconn_send(...)
There is no user_tcp_write_finish or serversendcb anymore ....
Then the logic freezes. How can I debug the error, or get out of the hold?
Is something wrong with the code?
I tested also to reset conn->readytosend in serversendcb.
User avatar
By Bummibaer
#35219 Hi,
I reset readytosend after sendcb, and it works better.
Basically, I want to send 24 bytes per second to an Android phone.
That should be not too much.
Where comes this MAXNUM Error from? From spec there are more than 2000 bytes in Fifo.
Please give me a hint.
User avatar
By Bummibaer
#35420 I've found the solution.
The ESCPONN_MAXNUM results from the count of TX-Queues. On can send 8 Packets before
sentcb
My problem was not to much data, but to few! I want to send 23 bytes every 500 ms!
I have to set
espconn_set_opt(ESPCONN_NODELAY)
:roll:
I've overread :
bit 1: 1: disable nagle algorithm during TCP data transmission, quiken the
data transmission.
the quiken word...
I hope it helps someone,
Steffen