Contents

CFSocketSetAddress(_:_:)

Binds a local address to a CFSocket object and configures it for listening.

Declaration

func CFSocketSetAddress(_ s: CFSocket!, _ address: CFData!) -> CFSocketError

Parameters

  • s:

    The CFSocket object to modify.

  • address:

    A CFData object containing a struct sockaddr appropriate for the protocol family of s (struct sockaddr_in or struct sockaddr_in6, for example). This data object is used only for the duration of the function call.

Return Value

An error code indicating success or failure.

Discussion

This function binds the socket by calling bind, and if the socket supports it, configures the socket for listening by calling listen with a backlog of 256.

Once s is bound to address, depending on the socket’s protocol, other processes and computers can connect to s.

See Also

Configuring Sockets