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-getpeername.html] - Blame information for rev 746

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
>getpeername</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="connect"
26
HREF="net-common-tcpip-manpages-connect.html"><LINK
27
REL="NEXT"
28
TITLE="getsockname"
29
HREF="net-common-tcpip-manpages-getsockname.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-connect.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-getsockname.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-GETPEERNAME">getpeername</H1
86
><TABLE
87
BORDER="5"
88
BGCOLOR="#E0E0F0"
89
WIDTH="70%"
90
><TR
91
><TD
92
><PRE
93
CLASS="SCREEN"
94
>GETPEERNAME(2)                System Calls Manual               GETPEERNAME(2)
95
 
96
NAME
97
     getpeername - get name of connected peer
98
 
99
SYNOPSIS
100
     #include &lt;sys/types.h&#62;
101
     #include &lt;sys/socket.h&#62;
102
 
103
     int
104
     getpeername(int s, struct sockaddr *name, socklen_t *namelen);
105
 
106
DESCRIPTION
107
     getpeername() returns the address information of the peer connected to
108
     socket s.  One common use occurs when a process inherits an open socket,
109
     such as TCP servers forked from inetd(8).  In this scenario,
110
     getpeername() is used to determine the connecting client's IP address.
111
 
112
     getpeername() takes three parameters:
113
 
114
     s Contains the file descriptor of the socket whose peer should be looked
115
     up.
116
 
117
     name Points to a sockaddr structure that will hold the address informa-
118
     tion for the connected peer.  Normal use requires one to use a structure
119
     specific to the protocol family in use, such as sockaddr_in (IPv4) or
120
     sockaddr_in6 (IPv6), cast to a (struct sockaddr *).
121
 
122
     For greater portability, especially with the newer protocol families, the
123
     new struct sockaddr_storage should be used.  sockaddr_storage is large
124
     enough to hold any of the other sockaddr_* variants.  On return, it can
125
     be cast to the correct sockaddr type, based the protocol family contained
126
     in its ss_family field.
127
 
128
     namelen Indicates the amount of space pointed to by name, in bytes.
129
 
130
     If address information for the local end of the socket is required, the
131
     getsockname(2) function should be used instead.
132
 
133
     If name does not point to enough space to hold the entire socket address,
134
     the result will be truncated to namelen bytes.
135
 
136
RETURN VALUES
137
     If the call succeeds, a 0 is returned and namelen is set to the actual
138
     size of the socket address returned in name.  Otherwise, errno is set and
139
     a value of -1 is returned.
140
 
141
ERRORS
142
     On failure, errno is set to one of the following:
143
 
144
     [EBADF]            The argument s is not a valid descriptor.
145
 
146
     [ENOTSOCK]         The argument s is a file, not a socket.
147
 
148
     [ENOTCONN]         The socket is not connected.
149
 
150
     [ENOBUFS]          Insufficient resources were available in the system to
151
                        perform the operation.
152
 
153
     [EFAULT]           The name parameter points to memory not in a valid
154
                        part of the process address space.
155
 
156
SEE ALSO
157
     accept(2), bind(2), getsockname(2), getpeereid(2), socket(2)
158
 
159
HISTORY
160
     The getpeername() function call appeared in 4.2BSD.
161
 
162
BSD                              July 17, 1999                             BSD
163
    </PRE
164
></TD
165
></TR
166
></TABLE
167
></DIV
168
><DIV
169
CLASS="NAVFOOTER"
170
><HR
171
ALIGN="LEFT"
172
WIDTH="100%"><TABLE
173
SUMMARY="Footer navigation table"
174
WIDTH="100%"
175
BORDER="0"
176
CELLPADDING="0"
177
CELLSPACING="0"
178
><TR
179
><TD
180
WIDTH="33%"
181
ALIGN="left"
182
VALIGN="top"
183
><A
184
HREF="net-common-tcpip-manpages-connect.html"
185
ACCESSKEY="P"
186
>Prev</A
187
></TD
188
><TD
189
WIDTH="34%"
190
ALIGN="center"
191
VALIGN="top"
192
><A
193
HREF="ecos-ref.html"
194
ACCESSKEY="H"
195
>Home</A
196
></TD
197
><TD
198
WIDTH="33%"
199
ALIGN="right"
200
VALIGN="top"
201
><A
202
HREF="net-common-tcpip-manpages-getsockname.html"
203
ACCESSKEY="N"
204
>Next</A
205
></TD
206
></TR
207
><TR
208
><TD
209
WIDTH="33%"
210
ALIGN="left"
211
VALIGN="top"
212
>connect</TD
213
><TD
214
WIDTH="34%"
215
ALIGN="center"
216
VALIGN="top"
217
><A
218
HREF="tcpip-library-reference.html"
219
ACCESSKEY="U"
220
>Up</A
221
></TD
222
><TD
223
WIDTH="33%"
224
ALIGN="right"
225
VALIGN="top"
226
>getsockname</TD
227
></TR
228
></TABLE
229
></DIV
230
></BODY
231
></HTML
232
>

powered by: WebSVN 2.1.0

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