Skip to content

Loosing last byte with readBytesUntil #290

Open
@danielkucera

Description

@danielkucera

I have following code:

            client_len = serverClients[i].readBytesUntil(_EOF, client_buf, MAX_FRAME_LENGTH);
            client_buf[client_len++] = serverClients[i].read();
            if (client_buf[client_len-1] != _EOF){
              //something strange happened
              serverClients[i].write("uhm");
              continue;
            }

How should I distinguish if _EOF character or MAX_FRAME_LENGTH or timeout has been reached?
The implementation reads the terminating character but then it is lost (not written to output buffer):

if (c < 0 || c == terminator) break;

See also: esp8266/Arduino#6546

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions