Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By JosePedro
#48871 Hey all!

I'm trying to figure out how to properly read binary data coming from the ESP8266 module and send it via WiFi (TCP).

In any other C based system, I'd so something like the following:
Code: Select allret = read(STDIN_FILENO, serial2wifiBuffer, length);


However, my 'read' call keeps returning -1 and doesn't block itself, as I thought it should.
Am I missing any kind of initialization on 'stdin'?

Also, I've noticed that, whenever I connect to the module via TCP, the created client socket descriptor has the value '1'. I thought the descriptors 0,1 and 2 were reserved for stdin, stdout and stderr, respectively...? In fact, <unistd.h> actually defines them as such.

My apologies if I'm missing any obvious detail here!
Thanks in advance.