| ![[Previous]](../image-lib/prev.gif) | ![[Contents]](../image-lib/contents.gif) | ![[Index]](../image-lib/keyword_index.gif) | ![[Next]](../image-lib/next.gif) | 
Bind a name to a socket
#include <sys/types.h>
#include <sys/socket.h>
int bind( int s,
          const struct sockaddr * name,
          size_t namelen );
socket3r.lib, socket3s.lib
When a socket is created with socket(), it exists in a namespace (address family) but has no name assigned to it. The bind() function assigns a name to that unnamed socket.
|  | The bind() function assigns a local address. Use connect() to assign a remote address. | 
The rules used for binding names vary between communication domains.
Standard Unix, POSIX 1003.1g (draft)
| Safety: | |
|---|---|
| Interrupt handler | No | 
| Signal handler | No | 
| Thread | Yes | 
ICMP, IP, ROUTE, TCP, UDP, and UNIX protocols
connect(), getsockname(), listen(), socket()
| ![[Previous]](../image-lib/prev.gif) | ![[Contents]](../image-lib/contents.gif) | ![[Index]](../image-lib/keyword_index.gif) | ![[Next]](../image-lib/next.gif) |