| Extracted from Pike v7.8 release 866 at 2018-02-09.

[Top]
Stdio
Stdio.Port

# Method Stdio.Port()->bind()

Method bind

  `int bind(int|string port, void|function accept_callback, void|string ip)`

Description

  Opens a socket and binds it to port number on the local machine. 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.

  If the optional argument ip is given, bind will try to bind to an interface with that host name or IP number.

Returns

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

See also

  accept , set_id