mcpp index

compat.usockets

#include

uSockets: eventing and networking layer under uWebSockets (libuv backend, no SSL)

#include <libusockets.h>
mcpp add compat.usockets@0.8.8

用法

來自本倉庫自己的測試專案 —— CI 真的編譯並執行過,不是為了網站寫的。

// Behavioral test: a real event loop iteration, driven by uSockets' own timer.
//
// The struct-layout hazard this package warns about is invisible to a build:
// `us_loop_t` has a different shape under LIBUS_USE_LIBUV, and a consumer that
// disagrees corrupts memory rather than failing to link. So the test allocates
// loop-attached extension memory, writes to it from a timer callback, and reads
// it back afterwards — if the layouts disagreed, that write lands somewhere else.
#include <libusockets.h>

#include <cassert>
#include <cstring>

namespace {

struct LoopExt {
    int ticks;
    int magic;
};

struct TimerExt {
    us_loop_t* loop;
    int budget;
// …

tests/examples/usockets/tests/loop.cpp · 專案 tests/examples/usockets

建置

targets
uSockets (lib)
language
c++23
C standard
c11
import std
no
include dirs
*/src

原始檔 (6)

  • */src/bsd.c
  • */src/context.c
  • */src/loop.c
  • */src/socket.c
  • */src/udp.c
  • */src/eventing/libuv.c

版本

版本平台 鏡像sha256
0.8.8 最新 LinuxWindowsmacOS GLOBAL CN d14d2efe1df7…