CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches
wasm_net_socket.cxh
1#include <cx/net/socket.cxh>
2#include <cx/platform/wasm.h>
3
4// Named NetSocketPosix, not NetSocketWasm, matching the precedent already set by
5// wasm_thread_threadobj.cxh's UnixThread: Emscripten's socket emulation is close enough to POSIX
6// (and this platform is never compiled alongside cx/platform/unix/, so there is no name collision)
7// that it is simpler to keep the same class name than invent a distinct one for what is otherwise
8// the same shape.
9//
10// send() is a concrete method on the base NetSocket now (its logic is platform-independent; only
11// the syscall lives behind a shim), so this class does not override it -- bind/listen still do,
12// because they touch sockaddr directly.
13class NetSocketPosix extends NetSocket
14{
15 int fd;
16
17 override close;
18
19 [canfail] factory create(NetSocketType type);
20 factory wrap(int fd, NetSocketType type, NetSocketState state);
21 destroy();
22}