A soocket is created without a name. Until a name is bound to a socket, processes have no way to reference it and, therefore, no messages may be received on it. the bind system call allows a process to specify local or its own half of the association, and the connect and accept calls are used to complete a socket's association.
The bind system call is used as follows:
#include <sys/types.h> #include <netinet/in.h> struct sockaddr_in sname; sname.sin_family = AF_INET; sname.sin_port = PORTNUM; sname.sin_addr.s_addr = INADDR_ANY; bind(fdTo,(char *)&sname, sizeof(sname));