thank me later

Creating sockets

Sockets are file descriptors returned by the C socket function.


#include <sys/socket.h>

int socket(int domain, int type, int protocol);

On error socket returns -1 and errno is set to one of the following:

On success, the function returns the fd of the new socket.

Socket domains

The domain specifies the address family. Valid address families are implementation defined.

Most used

Rarely used

Socket types

These are valid socket types: