read_until


Description:

public SocketIOStatus read_until (uint8[] buffer, void* boundary, size_t boundary_len, out size_t nread, bool got_boundary, Cancellable? cancellable = null) throws Error

Like read, but reads no further than the first occurrence of boundary .

(If the boundary is found, it will be included in the returned data, and *got_boundary will be set to true.) Any data after the boundary will returned in future reads.

read_until will almost always return fewer than buffer.length bytes: if the boundary is found, then it will only return the bytes up until the end of the boundary, and if the boundary is not found, then it will leave the last (boundary_len - 1) bytes in its internal buffer, in case they form the start of the boundary string. Thus, buffer.length normally needs to be at least 1 byte longer than boundary_len if you want to make any progress at all.

Parameters:

this

the socket

buffer

buffer to read into

boundary

boundary to read until

boundary_len

length of boundary in bytes

nread

on return, the number of bytes read into buffer

got_boundary

on return, whether or not the data in buffer ends with the boundary string

cancellable

a Cancellable, or null

len

size of buffer in bytes

Returns:

as for read