• Maybe I'm misundertanding, but when it's called the data hasn't arrived yet so available data reports 0? Espruino's event based, so you can't do like on Arduino and just block execution until data arrives. Using the callback as you suggested at the end is the right way to handle it.

    Content-Length is sent before everything else, so it's hardly surprising you get that in the header, before you have the 5 bytes.

About

Avatar for Gordon @Gordon started