Pike v8.0 release 1738

Method Stdio.Port()->bind_unix()


Method bind_unix

int bind_unix(string path, void|function(:void) accept_callback)

Description

Opens a Unix domain socket at the given path in the file system. If the second argument is present, the socket is set to nonblocking and the callback funcition is called whenever something connects to it. The callback will receive the id for this port as argument and should typically call accept to establish a connection.

Returns

1 is returned on success, zero on failure. errno provides further details about the error in the latter case.

Note

This function is only available on systems that support Unix domain sockets.

Note

path had a quite restrictive length limit (~100 characters) prior to Pike 7.8.334.

See also

accept, set_id