Used to create a socket of the specified address family and type. If the protocol is left unspecified (zero), then the system selects the protocol based on the address family and type.
#include <sys/kern_socket.h>
int kern_socreate (int addressfamily, ksocket_t *so, int type, int protocol)
Item | Description |
---|---|
addressfamily | The address family for the newly created socket. The file <sys/socket.h> contains
the definitions for the family. Currently AIX® supports:
|
so | The socket assigned by the create() call. The caller must pass the address of ksocket_t. |
type | The requested socket type. The file <sys/socket.h> contains the definition for the socket type. Currently AIX supports SOCK_STREAM. |
protocol | The file <netinet/in.h> contains the definition for the protocol. Currently AIX supports IPPROTO_TCP |
The kern_socreate kernel service creates a socket based on the address family, type and protocol.
The kern_socreate kernel service can be called from the process environment.
ksocket_t so;
ksocket _t so2;
kern_socreate(AF_INET, &so, SOCK_STREAM, IPPROTO_TCP);
kern_socreate(AF_INET6, &so2, SOCK_STREAM, 0);
Item | Description |
---|---|
0 | Upon Success |
>0 | Error |
The nonzero return value is the error number that is defined in the /usr/include/sys/errno.h file.