This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs. |
Bind a name to a socket
#include <sys/types.h> #include <sys/socket.h> int bind( int s, const struct sockaddr * name, socklen_t namelen );
libsocket
Use the -l socket option to qcc to link against this library.
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.
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | No |
Thread | Yes |
ICMP, IP, TCP, and UDP protocols
connect(), getsockname(), listen(), socket()