Commit | Line | Data |
---|---|---|
da268306 KB |
1 | .\" Copyright (c) 1983 The Regents of the University of California. |
2 | .\" All rights reserved. | |
c93f2ba8 | 3 | .\" |
1c15e888 C |
4 | .\" Redistribution and use in source and binary forms are permitted provided |
5 | .\" that: (1) source distributions retain this entire copyright notice and | |
6 | .\" comment, and (2) distributions including binaries display the following | |
7 | .\" acknowledgement: ``This product includes software developed by the | |
8 | .\" University of California, Berkeley and its contributors'' in the | |
9 | .\" documentation or other materials provided with the distribution and in | |
10 | .\" all advertising materials mentioning features or use of this software. | |
11 | .\" Neither the name of the University nor the names of its contributors may | |
12 | .\" be used to endorse or promote products derived from this software without | |
13 | .\" specific prior written permission. | |
14 | .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED | |
15 | .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF | |
16 | .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
da268306 | 17 | .\" |
1c15e888 | 18 | .\" @(#)getpeername.2 6.4 (Berkeley) 6/23/90 |
c93f2ba8 | 19 | .\" |
1c15e888 | 20 | .TH GETPEERNAME 2 "June 23, 1990" |
c93f2ba8 KM |
21 | .UC 5 |
22 | .SH NAME | |
23 | getpeername \- get name of connected peer | |
24 | .SH SYNOPSIS | |
25 | .nf | |
26 | .PP | |
27 | .ft B | |
28 | getpeername(s, name, namelen) | |
29 | int s; | |
30 | struct sockaddr *name; | |
31 | int *namelen; | |
32 | .fi | |
33 | .SH DESCRIPTION | |
34 | .I Getpeername | |
35 | returns the name of the peer connected to | |
36 | socket | |
37 | .IR s . | |
38 | The | |
39 | .I namelen | |
40 | parameter should be initialized to indicate | |
41 | the amount of space pointed to by | |
42 | .IR name . | |
43 | On return it contains the actual size of the name | |
44 | returned (in bytes). | |
e4589241 | 45 | The name is truncated if the buffer provided is too small. |
c93f2ba8 KM |
46 | .SH DIAGNOSTICS |
47 | A 0 is returned if the call succeeds, \-1 if it fails. | |
48 | .SH ERRORS | |
49 | The call succeeds unless: | |
50 | .TP 15 | |
51 | [EBADF] | |
52 | The argument \fIs\fP is not a valid descriptor. | |
53 | .TP 15 | |
54 | [ENOTSOCK] | |
55 | The argument \fIs\fP is a file, not a socket. | |
56 | .TP 15 | |
57 | [ENOTCONN] | |
58 | The socket is not connected. | |
59 | .TP 15 | |
60 | [ENOBUFS] | |
61 | Insufficient resources were available in the system | |
62 | to perform the operation. | |
63 | .TP 15 | |
64 | [EFAULT] | |
65 | The | |
66 | .I name | |
67 | parameter points to memory not in a valid part of the | |
68 | process address space. | |
69 | .SH "SEE ALSO" | |
e4589241 | 70 | accept(2), bind(2), socket(2), getsockname(2) |