OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [doc/] [html/] [ref/] [net-common-tcpip-manpages-getsockname.html] - Blame information for rev 858

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 28 unneback
<!-- Copyright (C) 2003 Red Hat, Inc.                                -->
2
<!-- This material may be distributed only subject to the terms      -->
3
<!-- and conditions set forth in the Open Publication License, v1.0  -->
4
<!-- or later (the latest version is presently available at          -->
5
<!-- http://www.opencontent.org/openpub/).                           -->
6
<!-- Distribution of the work or derivative of the work in any       -->
7
<!-- standard (paper) book form is prohibited unless prior           -->
8
<!-- permission is obtained from the copyright holder.               -->
9
<HTML
10
><HEAD
11
><TITLE
12
>getsockname</TITLE
13
><meta name="MSSmartTagsPreventParsing" content="TRUE">
14
<META
15
NAME="GENERATOR"
16
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
17
"><LINK
18
REL="HOME"
19
TITLE="eCos Reference Manual"
20
HREF="ecos-ref.html"><LINK
21
REL="UP"
22
TITLE="TCP/IP Library Reference"
23
HREF="tcpip-library-reference.html"><LINK
24
REL="PREVIOUS"
25
TITLE="getpeername"
26
HREF="net-common-tcpip-manpages-getpeername.html"><LINK
27
REL="NEXT"
28
TITLE="getsockopt"
29
HREF="net-common-tcpip-manpages-getsockopt.html"></HEAD
30
><BODY
31
CLASS="SECT1"
32
BGCOLOR="#FFFFFF"
33
TEXT="#000000"
34
LINK="#0000FF"
35
VLINK="#840084"
36
ALINK="#0000FF"
37
><DIV
38
CLASS="NAVHEADER"
39
><TABLE
40
SUMMARY="Header navigation table"
41
WIDTH="100%"
42
BORDER="0"
43
CELLPADDING="0"
44
CELLSPACING="0"
45
><TR
46
><TH
47
COLSPAN="3"
48
ALIGN="center"
49
>eCos Reference Manual</TH
50
></TR
51
><TR
52
><TD
53
WIDTH="10%"
54
ALIGN="left"
55
VALIGN="bottom"
56
><A
57
HREF="net-common-tcpip-manpages-getpeername.html"
58
ACCESSKEY="P"
59
>Prev</A
60
></TD
61
><TD
62
WIDTH="80%"
63
ALIGN="center"
64
VALIGN="bottom"
65
>Chapter 38. TCP/IP Library Reference</TD
66
><TD
67
WIDTH="10%"
68
ALIGN="right"
69
VALIGN="bottom"
70
><A
71
HREF="net-common-tcpip-manpages-getsockopt.html"
72
ACCESSKEY="N"
73
>Next</A
74
></TD
75
></TR
76
></TABLE
77
><HR
78
ALIGN="LEFT"
79
WIDTH="100%"></DIV
80
><DIV
81
CLASS="SECT1"
82
><H1
83
CLASS="SECT1"
84
><A
85
NAME="NET-COMMON-TCPIP-MANPAGES-GETSOCKNAME">getsockname</H1
86
><TABLE
87
BORDER="5"
88
BGCOLOR="#E0E0F0"
89
WIDTH="70%"
90
><TR
91
><TD
92
><PRE
93
CLASS="SCREEN"
94
>GETSOCKNAME(2)                System Calls Manual               GETSOCKNAME(2)
95
 
96
NAME
97
     getsockname - get socket name
98
 
99
SYNOPSIS
100
     #include &lt;sys/types.h&#62;
101
     #include &lt;sys/socket.h&#62;
102
 
103
     int
104
     getsockname(int s, struct sockaddr *name, socklen_t *namelen);
105
 
106
DESCRIPTION
107
     getsockname() returns the locally bound address information for a speci-
108
     fied socket.
109
 
110
     Common uses of this function are as follows:
111
 
112
     o   When bind(2) is called with a port number of 0 (indicating the kernel
113
         should pick an ephemeral port) getsockname() is used to retrieve the
114
         kernel-assigned port number.
115
 
116
     o   When a process calls bind(2) on a wildcard IP address, getsockname()
117
         is used to retrieve the local IP address for the connection.
118
 
119
     o   When a function wishes to know the address family of a socket,
120
         getsockname() can be used.
121
 
122
     getsockname() takes three parameters:
123
 
124
     s, Contains the file desriptor for the socket to be looked up.
125
 
126
     name points to a sockaddr structure which will hold the resulting address
127
     information.  Normal use requires one to use a structure specific to the
128
     protocol family in use, such as sockaddr_in (IPv4) or sockaddr_in6
129
     (IPv6), cast to a (struct sockaddr *).
130
 
131
     For greater portability (such as newer protocol families) the new struc-
132
     ture sockaddr_storage exists.  sockaddr_storage is large enough to hold
133
     any of the other sockaddr_* variants.  On return, it should be cast to
134
     the correct sockaddr type, according to the current protocol family.
135
 
136
     namelen Indicates the amount of space pointed to by name, in bytes.  Upon
137
     return, namelen is set to the actual size of the returned address infor-
138
     mation.
139
 
140
     If the address of the destination socket for a given socket connection is
141
     needed, the getpeername(2) function should be used instead.
142
 
143
     If name does not point to enough space to hold the entire socket address,
144
     the result will be truncated to namelen bytes.
145
 
146
RETURN VALUES
147
     On success, getsockname() returns a 0, and namelen is set to the actual
148
     size of the socket address returned in name.  Otherwise, errno is set,
149
     and a value of -1 is returned.
150
 
151
ERRORS
152
     If getsockname() fails, errno is set to one of the following:
153
 
154
     [EBADF]            The argument s is not a valid descriptor.
155
 
156
     [ENOTSOCK]         The argument s is a file, not a socket.
157
 
158
     [ENOBUFS]          Insufficient resources were available in the system to
159
                        perform the operation.
160
 
161
     [EFAULT]           The name parameter points to memory not in a valid
162
                        part of the process address space.
163
 
164
SEE ALSO
165
     accept(2), bind(2), getpeername(2), getpeereid(2), socket(2)
166
 
167
BUGS
168
     Names bound to sockets in the UNIX domain are inaccessible; getsockname
169
     returns a zero length name.
170
 
171
HISTORY
172
     The getsockname() function call appeared in 4.2BSD.
173
 
174
BSD                              July 17, 1999                             BSD
175
    </PRE
176
></TD
177
></TR
178
></TABLE
179
></DIV
180
><DIV
181
CLASS="NAVFOOTER"
182
><HR
183
ALIGN="LEFT"
184
WIDTH="100%"><TABLE
185
SUMMARY="Footer navigation table"
186
WIDTH="100%"
187
BORDER="0"
188
CELLPADDING="0"
189
CELLSPACING="0"
190
><TR
191
><TD
192
WIDTH="33%"
193
ALIGN="left"
194
VALIGN="top"
195
><A
196
HREF="net-common-tcpip-manpages-getpeername.html"
197
ACCESSKEY="P"
198
>Prev</A
199
></TD
200
><TD
201
WIDTH="34%"
202
ALIGN="center"
203
VALIGN="top"
204
><A
205
HREF="ecos-ref.html"
206
ACCESSKEY="H"
207
>Home</A
208
></TD
209
><TD
210
WIDTH="33%"
211
ALIGN="right"
212
VALIGN="top"
213
><A
214
HREF="net-common-tcpip-manpages-getsockopt.html"
215
ACCESSKEY="N"
216
>Next</A
217
></TD
218
></TR
219
><TR
220
><TD
221
WIDTH="33%"
222
ALIGN="left"
223
VALIGN="top"
224
>getpeername</TD
225
><TD
226
WIDTH="34%"
227
ALIGN="center"
228
VALIGN="top"
229
><A
230
HREF="tcpip-library-reference.html"
231
ACCESSKEY="U"
232
>Up</A
233
></TD
234
><TD
235
WIDTH="33%"
236
ALIGN="right"
237
VALIGN="top"
238
>getsockopt</TD
239
></TR
240
></TABLE
241
></DIV
242
></BODY
243
></HTML
244
>

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.