qb  2.0.0.0
C++17 Actor Framework
qb Issue Watch Star Fork Follow @isndev
Loading...
Searching...
No Matches
qb::io::async::event::eof Struct Reference

Event triggered when no more data is available for reading from an input stream. More...

#include <eof.h>

Detailed Description

Event triggered when no more data is available for reading from an input stream.

This event is passed to the derived class's on(qb::io::async::event::eof&&) method when an attempt to read from an input I/O object (e.g., TCP socket, file) yields no new data, and the input buffer (after protocol processing) is also empty. It signals that the end of the input stream has been reached or the read operation would block.

This is distinct from qb::io::async::event::disconnected, which signals a connection closure. An eof might occur on a still-open connection if the peer has simply stopped sending data.

Usage Example:

class MyInputHandler : public qb::io::async::input<MyInputHandler> { // Or similar base
public:
// ... protocol definition and other methods ...
void on(qb::io::async::event::eof &&) {
LOG_INFO("End of file/stream reached for input.");
// Optionally, close the input stream or take other actions.
// For example, if this is a client, it might decide to disconnect.
// this->disconnect();
}
};
CRTP base class for managing asynchronous input operations with protocol processing.
Definition io.h:517
#define LOG_INFO(X)
Info-level log macro (no-op if QB_STDOUT_LOG is not defined)
Definition io.h:229