6#include <SDL3/SDL_stdinc.h>
8#include <SDL3_net/SDL_net.h>
30 bool send(
const void* data, Uint32 size);
36 bool poll(
const std::function<
void(
const void* data, Uint32 size)>& callback);
39 std::vector<Uint8> recvBuf;
Length-prefixed framing layer over a TCP stream socket.
Definition MessageStream.hpp:19
MessageStream(NET_StreamSocket *sock)
Definition MessageStream.hpp:22
bool poll(const std::function< void(const void *data, Uint32 size)> &callback)
Read all available bytes from the socket and invoke the callback once per complete message frame.
Definition MessageStream.cpp:16
NET_StreamSocket * socket
Underlying SDL_net stream socket.
Definition MessageStream.hpp:24
bool send(const void *data, Uint32 size)
Send a framed message over the socket.
Definition MessageStream.cpp:6