A socket that is created with the socket function remains in the assigned address family. To enable the socket to receive connections, an address needs to be assigned to it. The bind function assigns the address to the specified socket. Here is its syntax:
int bind(int fdsock, const struct sockaddr *structaddr, socklen_t lenaddr);
Here, fdsock represents the file descriptor of the socket, structaddr represents the sockaddr structure that contains the address to be assigned to the socket, and lenaddr represents the size of the address structure that's pointed to by structaddr.