Creating sockets

In C language:

It is a means of communication, originally implemented by the University of Berkeley, between applications.

When using the "socket library" in C language, you should include the header files corresponding to this system library and the constants used.

#include <sys/types.h>
#include <netdb.h>
#include <sys/socket.h>
	

The first step is to create a socket via the system call:

int socket (int domaine, int type, int protocole);
	

Notes:

fd_tcp = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
fd_udp = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP);
	
$socket_tcp = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
$socket_udp = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
	

sock_tcp = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock_udp = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)