Home
Main website
Display Sidebar
Hide Ads
Recent Changes
View Source:
bind(2)
Edit
PageHistory
Diff
Info
LikePages
You are viewing an old revision of this page.
View the current version
.
BIND !!!BIND NAME SYNOPSIS DESCRIPTION NOTES RETURN VALUE ERRORS BUGS CONFORMING TO NOTE SEE ALSO ---- !!NAME bind - bind a name to a socket !!SYNOPSIS __#include __ #include __ __int bind(int__ ''sockfd''__, struct sockaddr *__''my_addr''__, socklen_t__ ''addrlen''__);__ !!DESCRIPTION __bind__ gives the socket ''sockfd'' the local address ''my_addr''. ''my_addr'' is ''addrlen'' bytes long. Traditionally, this is called ``assigning a name to a socket.'' When a socket is created with socket(2), it exists in a name space (address family) but has no name assigned. It is normally necessary to assign a local address using __bind__ before a __SOCK_STREAM__ socket may receive connections (see accept(2)). !!NOTES The rules used in name binding vary between address families. Consult the manual entries in Section 7 for detailed information. For __AF_INET__ see ip(7), for __AF_UNIX__ see unix(7), for __AF_APPLETALK__ see ddp(7), for __AF_PACKET__ see packet(7), for __AF_X25__ see __x25__(7) and for __AF_NETLINK__ see netlink(7). !!RETURN VALUE On success, zero is returned. On error, -1 is returned, and ''errno'' is set appropriately. !!ERRORS __EBADF__ ''sockfd'' is not a valid descriptor. __EINVAL__ The socket is already bound to an address. This may change in the future: see ''linux/unix/sock.c'' for details. __EACCES__ The address is protected, and the user is not the super-user. __ENOTSOCK__ Argument is a descriptor for a file, not a socket. The following errors are specific to UNIX domain (__AF_UNIX__) sockets: __EINVAL__ The ''addrlen'' is wrong, or the socket was not in the __AF_UNIX__ family. __EROFS__ The socket inode would reside on a read-only file system. __EFAULT__ ''my_addr'' points outside the user's accessible address space. __ENAMETOOLONG__ ''my_addr'' is too long. __ENOENT__ The file does not exist. __ENOMEM__ Insufficient kernel memory was available. __ENOTDIR__ A component of the path prefix is not a directory. __EACCES__ Search permission is denied on a component of the path prefix. __ELOOP__ Too many symbolic links were encountered in resolving ''my_addr''. !!BUGS The transparent proxy options are not described. !!CONFORMING TO SVr4, 4.4BSD (the __bind__ function first appeared in BSD 4.2). SVr4 documents additional __EADDRNOTAVAIL__, __EADDRINUSE__, and __ENOSR__ general error conditions, and additional __EIO__ and __EISDIR__ Unix-domain error conditions. !!NOTE The third argument of __bind__ is in reality an int (and this is what BSD 4.* and libc4 and libc5 have). Some POSIX confusion resulted in the present socklen_t. The draft standard has not been adopted yet, but glibc2 already follows it and also has socklen_t. See also accept(2). !!SEE ALSO accept(2), connect(2), listen(2), socket(2), getsockname(2), ip(7), socket(7) ----
30 pages link to
bind(2)
:
AddressFamily
udp(7)
EAFNOSUPPORT
ddp(7)
ndc(8)
socketcall(2)
tcp(7)
Man2b
services(5)
root
freeaddrinfo(3)
gai_strerror(3)
getaddrinfo(3)
netlink(7)
unix(7)
raw(7)
socket(7)
tcptraceroute(8)
connect(2)
getpeername(2)
socket(2)
getsockname(2)
packet(7)
accept(2)
EADDRNOTAVAIL
listen(2)
NetworkProgramming
NetworkProgrammingOld
ENOTDIR
ip(7)
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.