api

async.ch

Declarations in async.ch

1 declarationsnet

Declarations

Public only
net#
Publicnamespace
namespace net
by two compiler limitations:
AsyncSocket#
Publicstruct
struct AsyncSocket { var fd : int }
valid#
Publicfunction
func valid(self : &AsyncSocket) : bool
raw#
Publicfunction
func raw(self : &AsyncSocket) : int
close#
Publicfunction
func close(self : &AsyncSocket) : void
read#
Publicfunction
func read(self : &AsyncSocket, buf : *u8, cap : usize) : FutureHandle<int>
Await the next chunk of bytes (0 = EOF, <0 = error).
write#
Publicfunction
func write(self : &AsyncSocket, data : *char, len : int) : FutureHandle<int>
Await a full write of `len` bytes (returns `len`, or <0 on error).
accept#
Publicfunction
func accept(self : &AsyncSocket) : FutureHandle<int>
Await the next inbound connection; resolves with the accepted fd (>0) or 0.
async_socket#
Publicfunction
func async_socket(fd : int) : AsyncSocket
Wrap a raw fd.
async_listener#
Publicfunction
func async_listener(addr_str : *char, port : uint) : AsyncSocket
Bind + listen synchronously (fast) and return an async listener.
dial_async#
Publicfunction
func dial_async(addr_str : *char, port : uint) : FutureHandle<int>
---- connect ---------------------------------------------------------------
accept_async#
Publicfunction
func accept_async(listener : int) : FutureHandle<int>
---- accept ----------------------------------------------------------------
recv_async#
Publicfunction
func recv_async(fd : int, buf : *u8, cap : usize) : FutureHandle<int>
---- recv / send -----------------------------------------------------------
send_async#
Publicfunction
func send_async(fd : int, data : *char, len : int) : FutureHandle<int>