jsocketpp 1.0
A cross-platform C++20 socket library.
Loading...
Searching...
No Matches

Represents a raw writable memory region for scatter/gather I/O. More...

#include <BufferView.hpp>

Public Attributes

void * data {}
 Pointer to the writable memory region.
std::size_t size {}
 Size in bytes of the writable region.

Detailed Description

Represents a raw writable memory region for scatter/gather I/O.

BufferView is used to describe non-contiguous writable memory ranges for use with vectorized socket operations (e.g., readv, writev, readvAll).

It allows efficient I/O without copying or concatenating buffers, enabling zero-copy messaging and protocol framing.

Fields

  • data: Pointer to writable memory
  • size: Size in bytes of the memory region

Example Usage

std::array<std::byte, 4> header;
std::array<std::byte, 128> payload;
std::array<jsocketpp::BufferView, 2> views = {
jsocketpp::BufferView{header.data(), header.size()},
jsocketpp::BufferView{payload.data(), payload.size()}
};
socket.readvAll(views);
Represents a raw writable memory region for scatter/gather I/O.
Definition BufferView.hpp:43
See also
Socket::readv()
Socket::writevFrom()

Member Data Documentation

◆ data

void* jsocketpp::BufferView::data {}

Pointer to the writable memory region.

◆ size

std::size_t jsocketpp::BufferView::size {}

Size in bytes of the writable region.


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