Function

sock_socket

Declaration

errno_t sock_socket(int domain, int type, int protocol, sock_upcall callback, void *cookie, socket_t *new_so);

Parameters

domain

The socket domain (PF_INET, etc...).

type

The socket type (SOCK_STREAM, SOCK_DGRAM, etc...).

protocol

The socket protocol.

callback

A notifier function to be called when an event occurs on the socket. This may be NULL.

cookie

A cookie passed directly to the callback.

new_so

Upon success, a reference to the new socket.

Return Value

0 on success otherwise the errno error.

Discussion

Allocate a socket. Allocating a socket in this manner creates a socket with no associated file descriptor. For more information, see 'man 2 socket'.