Io module

unix_listen

procedureextensionexperimentalsince 0.27.0Source

Listens on the socket file path. The file must not exist yet; with replace an existing file at path is removed first (whatever it is, so use it only for a path you own). The socket file stays after close: remove it when the server is done.

Example
Io :: #import "Extensions/Io";

#import "File";

Io.io_run(() {
    listener, error := Io.unix_listen("/tmp/jacket-io-unix.sock", replace = true);
    assert(error == .NONE);
    Io.close(listener);
});
file_delete("/tmp/jacket-io-unix.sock");

Doesn't run in the browser (only on linux, macos).

unix_listen :: (
    path: string,
    backlog := 128,
    replace := false
) -> (Tcp_Listener, Io_Error)

Parameters

path: string
backlog := 128
replace := false

Returns

See also