api

main.ch

Declarations in main.ch

1 declarationsnet

Declarations

Public only
net#
Publicnamespace
namespace net
Socket#
Publictypealias
type Socket = usize
timeval#
struct
struct timeval { var tv_sec : long var tv_usec : long }
set_recv_timeout#
Publicfunction
func set_recv_timeout(s : Socket, secs : long, usecs : long) : void
helper: set socket recv timeout (seconds + microseconds)
set_keep_alive#
Publicfunction
func set_keep_alive(s : Socket, enable : bool) : void
helper: set keep alive
htons_port#
Publicfunction
func htons_port(p : u16) : u16
listen_addr#
Publicfunction
func listen_addr(addr_str : *char, port : uint) : Socket
listen by address string and port using getaddrinfo -> bind -> listen loop
accept_socket#
Publicfunction
func accept_socket(listen_sock : Socket) : Socket
recv_all#
Publicfunction
func recv_all(s : Socket, buf : *u8, cap : usize) : int
send_all#
Publicfunction
func send_all(s : Socket, p : *char, len : int) : int
close_socket#
Publicfunction
func close_socket(s : Socket) : void
dial#
Publicfunction
func dial(addr_str : *char, port : uint) : Socket