Current Lua downloadable firmware will be posted here

User avatar
By osionnaigh
#58061 I am using NodeMCU 0.9.5 and sending long GET/POST command including long pieces of data as expected by server (which is expecting everything in one command).
Once the total command goes above 255 characters, remaining characters are ignored by NodeMCU and error is flagged.
I suspect based on reading UART documentation that the UART buffer limit is hit.
Does anyone have a way around that, where a LUA command can be broken into 2 pieces and 2nd command continues on the first etc.

Command looks like
sk3:send('POST /data HTTP/1.1\r\nContent-Length: 89\r\nContent-Type: text/plain\r\nHost: xxxx.xxxxxx.com\r\nConnection: close\r\n\r\na>>>>DATA>>>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')

Total length is 272 characters.
Thanks
OS.
User avatar
By marcelstoer
#58104 I suggest you don't use those old 0.9.x binaries. They're hopelessly outdated and not maintained.

Other hints (assuming I understand your problem):

  • Use variables and string concatenation if you think the issue is UART
    Code: Select allhost = 'xxxx.xxxxxx.com'
    data = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
    sk3:send('POST /data HTTP/1.1\r\nContent-Length: 89\r\nContent-Type: text/plain\r\nHost: ' .. host .. '\r\nConnection: close\r\n\r\na>>>>DATA>>>' .. data)
  • With newer versions of the SDK (> 0.9.x) Espressif "fixed" socket send() as it's no longer blocking/synchronous which is a good thing. See net.socket:send() for examples how to handle this is current NodeMCU versions.
  • With current NodeMCU versions you can include the HTTP module which makes interacting with HTTP endpoints a lot easier.