You are reading a single comment by @net-tobi and its replies. Click here to read the full conversation.
  • Hello Gordon,

    I tried to solve it like this yesterday night:

      /* Send data. Returns the number of bytes sent - 0 is ok.
      Less than 0  */
      send: function(sckt, data) {
        if (busy || at.isBusy() || socks[sckt]=="Wait") return 0;
        if (!socks[sckt]) return -1; // error - close it
        busy = true;
        at.register('>', function() {
          console.log('READY');
          at.unregister('>');
          at.write(data);
          return "";
        });
        at.registerLine(sckt + ', SEND OK', function() {
          at.unregisterLine(sckt + ', SEND OK');
          busy = false;
          return "";
        });
        at.cmd('AT+CIPSEND='+sckt+','+data.lengt­h+'\r\n');
        at.debug();
        return data.length;
      }
    };
    

    But for some reason I ran into a deadlock situation where busy was set to true but no SEND OK came in to remove it in some cases.

    I will try your solution without waiting for SEND OK and give you a feedback.

About

Avatar for net-tobi @net-tobi started