bind.2: ffix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2017-08-15 11:36:49 +02:00
parent 8811e15a9e
commit 15e88fe8f4
1 changed files with 12 additions and 12 deletions

View File

@ -72,7 +72,7 @@ bind \- bind a name to a socket
.nf
.BR "#include <sys/types.h>" " /* See NOTES */"
.B #include <sys/socket.h>
.sp
.PP
.BI "int bind(int " sockfd ", const struct sockaddr *" addr ,
.BI " socklen_t " addrlen );
.fi
@ -96,7 +96,7 @@ before a
.B SOCK_STREAM
socket may receive connections (see
.BR accept (2)).
.PP
The rules used in name binding vary between address families.
Consult the manual entries in Section 7 for detailed information.
For
@ -127,23 +127,23 @@ and for
.BR AF_NETLINK ,
see
.BR netlink (7).
.PP
The actual structure passed for the
.I addr
argument will depend on the address family.
The
.I sockaddr
structure is defined as something like:
.PP
.in +4n
.nf
.EX
struct sockaddr {
sa_family_t sa_family;
char sa_data[14];
}
.fi
.EE
.in
.PP
The only purpose of this structure is to cast the structure
pointer passed in
.I addr
@ -247,7 +247,7 @@ POSIX.1 does not require the inclusion of
and this header file is not required on Linux.
However, some historical (BSD) implementations required this header
file, and portable applications are probably wise to include it.
.PP
For background on the
.I socklen_t
type, see
@ -260,15 +260,15 @@ An example of the use of
.BR bind ()
with Internet domain sockets can be found in
.BR getaddrinfo (3).
.PP
The following example shows how to bind a stream socket in the UNIX
.RB ( AF_UNIX )
domain, and accept connections:
.\" listen.7 refers to this example.
.\" accept.7 refers to this example.
.\" unix.7 refers to this example.
.nf
.PP
.EX
#include <sys/socket.h>
#include <sys/un.h>
#include <stdlib.h>
@ -319,7 +319,7 @@ main(int argc, char *argv[])
/* When no longer required, the socket pathname, MY_SOCK_PATH
should be deleted using unlink(2) or remove(3) */
}
.fi
.EE
.SH SEE ALSO
.BR accept (2),
.BR connect (2),