You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The WiFiClient inherits from Stream which has the readBytes function. I got confused using the read function that reads multiple bytes, this essentially does the same thing as readBytes but doesn't leverage other Stream functionality (e.g. timeouts). Is the read function with multiple parameters necessary? Could it just be removed to avoid confusion?
The text was updated successfully, but these errors were encountered:
The read(buffer, size) function must be implemented because it is pure virtual in Client which is the core base class for WiFiClient. Usually use of read(buffer, size) is much more efficient for networking than read(byte), because it can read out the internal buffers faster. But unfortunately If Client is accessed as Stream, this method is not visible.
Some years ago I prepared a git pull request to add read(buffer,size) to Stream, but then I canceled it because as you say it would cause confusion.
readBytes is implemented in Stream.h (base class for Client.h) and it is one of the blocking function which wait for the next byte.
there are some historical backward compatibility reasons for the current design of the Print<-Stream<-Client hierarchy.
The
WiFiClient
inherits fromStream
which has thereadBytes
function. I got confused using theread
function that reads multiple bytes, this essentially does the same thing asreadBytes
but doesn't leverage otherStream
functionality (e.g. timeouts). Is theread
function with multiple parameters necessary? Could it just be removed to avoid confusion?The text was updated successfully, but these errors were encountered: