-->
Page 1 of 1

String, WiFiClient and binary data

PostPosted: Wed Oct 11, 2017 3:41 pm
by Maxim Kulkin
Hi. I'm writing a small project and I needed to implement a small protocol that transfers binary data on top of HTTP. I started with ESP8266WebServer but eventually found out that it uses WiFiClient::readString() (to read data from wire and parse it to HTTP request) which returns String object. The problem is that String object does not play nice with zero chars (e.g. if you do String::substring(), it will stop at first zero char without copying the rest).

Eventually I ended up implementing my own class - Buffer - which is String-like object with focus on binary data.

Do you think it is worth adding to SDK ? Do you think it worth fixing String to handle binary data (although that might break some existing behavior) ?