spelling
[unix-history] / usr / src / lib / libc / sys / getpeername.2
CommitLineData
c93f2ba8
KM
1.\" Copyright (c) 1983 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
e4589241 5.\" @(#)getpeername.2 6.2 (Berkeley) %G%
c93f2ba8 6.\"
cb0beb2a 7.TH GETPEERNAME 2 ""
c93f2ba8
KM
8.UC 5
9.SH NAME
10getpeername \- get name of connected peer
11.SH SYNOPSIS
12.nf
13.PP
14.ft B
15getpeername(s, name, namelen)
16int s;
17struct sockaddr *name;
18int *namelen;
19.fi
20.SH DESCRIPTION
21.I Getpeername
22returns the name of the peer connected to
23socket
24.IR s .
25The
26.I namelen
27parameter should be initialized to indicate
28the amount of space pointed to by
29.IR name .
30On return it contains the actual size of the name
31returned (in bytes).
e4589241 32The name is truncated if the buffer provided is too small.
c93f2ba8
KM
33.SH DIAGNOSTICS
34A 0 is returned if the call succeeds, \-1 if it fails.
35.SH ERRORS
36The call succeeds unless:
37.TP 15
38[EBADF]
39The argument \fIs\fP is not a valid descriptor.
40.TP 15
41[ENOTSOCK]
42The argument \fIs\fP is a file, not a socket.
43.TP 15
44[ENOTCONN]
45The socket is not connected.
46.TP 15
47[ENOBUFS]
48Insufficient resources were available in the system
49to perform the operation.
50.TP 15
51[EFAULT]
52The
53.I name
54parameter points to memory not in a valid part of the
55process address space.
56.SH "SEE ALSO"
e4589241 57accept(2), bind(2), socket(2), getsockname(2)