virtual Data read(size_t max_octets = 0) throw (read_error) = 0;
ssize_t read(int fd, void *buf, size_t count);
read()
function and the conexus library read()
method, and explains the reasons for differing.read()
operation will not only return the data as a result of calling the method, but will also emit any signals necessary including delivery of data to those connected to the endpoint along with sending notifications of a read operation.read()
method does not accept a file descriptor as a parameter.read()
method does not accept a pointer in which the read data will be stored.
Despite the differences, there remains a similarity between the max_octets
and the count
parameter. In the POSIX API the count
parameter is used to indicate that buf
points to an allocated storage area of at least count
octets, and additionally places an upper limit on the number of octets that will be read in. The max_octets
fills the latter role, and indicates the upper limit on the octets to read in. As with the POSIX API, the actual number of octets read may not be equal to the requested octets. The return conexus::Data object's size
member will indicate the actual number of octets read, while the data
member will contain a smart pointer to the actual data.
The following image illustrates the sequence of operations in receiving data via the read()
method.
Sequence of operations that occur when the read
() method is called.
When a callback has been registered with the endpoint a read()
operation will simultaneously deliver the endpoint data to the read()
method caller and to all connected callbacks.
The following image illustrates the sequence of operations in receiving data via the read()
method when a callback has been registered with the endpoint.
Sequence of operations that occur when the read
() method is called and a callback has been registered with the endpoint.