Import with #import "std/socket_linux".

LinuxSocket :: struct { fd: s32; valid: bool; error: s32; }
LinuxSocketEvent :: struct { ready: s32; error: s32; }
LinuxSocketAddress :: struct { family: u16; port: u16; address: u32; zero: [8]u8; }
LinuxPollFd :: struct { fd: s32; events: s16; revents: s16; }
LinuxErrno :: () -> s32
SocketWaitForEvents :: (socket: LinuxSocket, events: s32, timeout_ms: s32) -> LinuxSocketEvent
SocketConnectError :: (socket: LinuxSocket) -> s32
OpenTCPv4 :: (address: [4]u8, port: u16, timeout_ms: s32) -> LinuxSocket
SocketCloseWrite :: (socket: LinuxSocket) -> bool

Signal write EOF while keeping this owned descriptor readable. Repeating a successful write shutdown is harmless; SocketClose still releases ownership.

SocketCancel :: (socket: LinuxSocket) -> bool
SocketSendAll :: (socket: LinuxSocket, input: []u8, timeout_ms: s32) -> s64
SocketReceive :: (socket: LinuxSocket, output: []u8, timeout_ms: s32) -> s64
SocketClose :: (socket: *LinuxSocket) -> bool

Source ↗ · All modules