net

API Reference

Structs

struct TcpStream

A thin synchronous wrapper around a connected TCP file descriptor.

struct TcpListener

A blocking IPv4 TCP listener backed by a host file descriptor.

Globals

let AF_INET: Int

Host socket domain for IPv4 addresses.

let INADDR_ANY: Int

IPv4 wildcard address used to bind all local interfaces.

let LOCALHOST: Int

IPv4 loopback address in host integer form.

Functions

func _io_socket(domain: Int, socktype: Int, proto: Int) 'io -> Int

Creates a host socket; returns its descriptor or a negative errno.

func _io_bind(fd: Int, addr: Int, port: Int) 'io -> Int

Binds fd to an IPv4 address and port; returns zero or a negative errno.

func _io_listen(fd: Int, backlog: Int) 'io -> Int

Starts listening on fd with the requested pending-connection backlog.

func _io_connect(fd: Int, addr: Int, port: Int) 'io -> Int

Connects fd to an IPv4 address and port; returns zero or a negative errno.

func _io_accept(fd: Int) 'io -> Int

Accepts one pending connection; returns its descriptor or a negative errno.