socket

public func socket(Int32, Int32, Int32) -> Int32

Wraps socket(2) — creates a new socket fd.

Returns the new file descriptor on success, or -1 on error (call errno() for the cause). The caller owns the fd and is responsible for closing it via close.

Examples

let fd = socket(AF_INET(), SOCK_STREAM(), IPPROTO_TCP()); if fd < 0 { /* errno() */ }

Defined in lang/std/net/libc.ks