~ubuntu-branches/ubuntu/precise/manpages-posix/precise

1 by Francesco Paolo Lovergine
rules: linking manpages-posix not manpages.
1
.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved 
2 by Francesco Paolo Lovergine
* Alligned to linux main manpages edition.
2
.TH "GETSOCKNAME" P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
1 by Francesco Paolo Lovergine
rules: linking manpages-posix not manpages.
3
.\" getsockname 
4
.SH NAME
5
getsockname \- get the socket name
6
.SH SYNOPSIS
7
.LP
8
\fB#include <sys/socket.h>
9
.br
10
.sp
11
int getsockname(int\fP \fIsocket\fP\fB, struct sockaddr *restrict\fP
12
\fIaddress\fP\fB,
13
.br
14
\ \ \ \ \ \  socklen_t *restrict\fP \fIaddress_len\fP\fB);
15
.br
16
\fP
17
.SH DESCRIPTION
18
.LP
19
The \fIgetsockname\fP() function shall retrieve the locally-bound
20
name of the specified socket, store this address in the
21
\fBsockaddr\fP structure pointed to by the \fIaddress\fP argument,
22
and store the length of this address in the object pointed to
23
by the \fIaddress_len\fP argument.
24
.LP
25
If the actual length of the address is greater than the length of
26
the supplied \fBsockaddr\fP structure, the stored address
27
shall be truncated.
28
.LP
29
If the socket has not been bound to a local name, the value stored
30
in the object pointed to by \fIaddress\fP is
31
unspecified.
32
.SH RETURN VALUE
33
.LP
34
Upon successful completion, 0 shall be returned, the \fIaddress\fP
35
argument shall point to the address of the socket, and the
36
\fIaddress_len\fP argument shall point to the length of the address.
37
Otherwise, -1 shall be returned and \fIerrno\fP set to
38
indicate the error.
39
.SH ERRORS
40
.LP
41
The \fIgetsockname\fP() function shall fail if:
42
.TP 7
43
.B EBADF
44
The \fIsocket\fP argument is not a valid file descriptor.
45
.TP 7
46
.B ENOTSOCK
47
The \fIsocket\fP argument does not refer to a socket.
48
.TP 7
49
.B EOPNOTSUPP
50
The operation is not supported for this socket's protocol.
51
.sp
52
.LP
53
The \fIgetsockname\fP() function may fail if:
54
.TP 7
55
.B EINVAL
56
The socket has been shut down.
57
.TP 7
58
.B ENOBUFS
59
Insufficient resources were available in the system to complete the
60
function.
61
.sp
62
.LP
63
\fIThe following sections are informative.\fP
64
.SH EXAMPLES
65
.LP
66
None.
67
.SH APPLICATION USAGE
68
.LP
69
None.
70
.SH RATIONALE
71
.LP
72
None.
73
.SH FUTURE DIRECTIONS
74
.LP
75
None.
76
.SH SEE ALSO
77
.LP
78
\fIaccept\fP() , \fIbind\fP() , \fIgetpeername\fP() , \fIsocket\fP()
79
, the Base Definitions volume of
80
IEEE\ Std\ 1003.1-2001, \fI<sys/socket.h>\fP
81
.SH COPYRIGHT
82
Portions of this text are reprinted and reproduced in electronic form
83
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
84
-- Portable Operating System Interface (POSIX), The Open Group Base
85
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
86
Electrical and Electronics Engineers, Inc and The Open Group. In the
87
event of any discrepancy between this version and the original IEEE and
88
The Open Group Standard, the original IEEE and The Open Group Standard
89
is the referee document. The original Standard can be obtained online at
90
http://www.opengroup.org/unix/online.html .