4
\description{When a socket is created it is attached to an address family, but it
5
doesn't have an address in this family. \code{\link{gSocketBind}} assigns the
6
address (sometimes called name) of the socket.}
7
\usage{gSocketBind(object, address, allow.reuse, .errwarn = TRUE)}
9
\item{\verb{object}}{a \code{\link{GSocket}}.}
10
\item{\verb{address}}{a \code{\link{GSocketAddress}} specifying the local address.}
11
\item{\verb{allow.reuse}}{whether to allow reusing this address}
12
\item{.errwarn}{Whether to issue a warning on error or fail silently}
14
\details{It is generally required to bind to a local address before you can
15
receive connections. (See \code{\link{gSocketListen}} and \code{\link{gSocketAccept}} ).
16
In certain situations, you may also want to bind a socket that will be
17
used to initiate connections, though this is not normally required.
18
\code{allow.reuse} should be \code{TRUE} for server sockets (sockets that you will
19
eventually call \code{\link{gSocketAccept}} on), and \code{FALSE} for client sockets.
20
(Specifically, if it is \code{TRUE}, then \code{\link{gSocketBind}} will set the
21
\code{SO_REUSEADDR} flag on the socket, allowing it to bind \code{address} even if
22
that address was previously used by another socket that has not yet been
23
fully cleaned-up by the kernel. Failing to set this flag on a server
24
socket may cause the bind call to return \code{G_IO_ERROR_ADDRESS_IN_USE} if
25
the server program is stopped and then immediately restarted.)
28
A list containing the following elements:
29
\item{retval}{[logical] \code{TRUE} on success, \code{FALSE} on error.}
30
\item{\verb{error}}{\code{\link{GError}} for error reporting, or \code{NULL} to ignore.}
32
\author{Derived by RGtkGen from GTK+ documentation}