COROIO: TSocketBase< TSockOps > Class Reference
COROIO
 
Loading...
Searching...
No Matches
TSocketBase< TSockOps > Class Reference

Template base class implementing asynchronous socket I/O operations. More...

#include <socket.hpp>

Detailed Description

Template base class implementing asynchronous socket I/O operations.

This class extends the internal TSocketBase<void> by implementing asynchronous operations based on a type-specific socket operations trait, TSockOps. The TSockOps type must implement the following static methods:

  • static int TSockOps::read(int fd, void* buf, size_t size)
  • static int TSockOps::write(int fd, const void* buf, size_t size)
  • static int TSockOps::close(int fd)

It provides awaitable methods for reading and writing:

  • ReadSome() and ReadSomeYield() perform asynchronous reads.
  • WriteSome() and WriteSomeYield() perform asynchronous writes.
  • Monitor() provides an awaitable to detect remote hang-ups.

Both variants such as TSocket and TFileHandle (or similarly named higher-level wrappers) inherit from this class and expose the more user-friendly API. End users should use these derived classes, rather than interacting with TSocketBase<TSockOps> directly.

Template Parameters
TSockOpsThe type that provides low-level socket operations.

The documentation for this class was generated from the following file: