socket)Creates a socket for network communication.
int socket(int domain, int type, int protocol);
Parameters:
domain: Specifies the address family, such as AF_INET (IPv4) or AF_INET6 (IPv6).type: Defines the socket type, like SOCK_STREAM (TCP) or SOCK_DGRAM (UDP).protocol: Indicates the specific protocol to use, often set to 0 for the default protocol.Return Value:
-1 on error, and you can check errno for the specific error condition.bind)Associates a socket with a specific local address.
int bind(int sockfd, struct sockaddr *my_addr, int addrlen);
Parameters:
sockfd: The socket descriptor returned by socket.sockaddr: A pointer to a struct sockaddr containing the local address information.addrlen: The length of the sockaddr structure.Return Value: