|
|
1.1 root 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: .\"
5: .\" @(#)getpeername.2 6.2 (Berkeley) 5/13/86
6: .\"
7: .TH GETPEERNAME 2 "May 13, 1986"
8: .UC 5
9: .SH NAME
10: getpeername \- get name of connected peer
11: .SH SYNOPSIS
12: .nf
13: .PP
14: .ft B
15: getpeername(s, name, namelen)
16: int s;
17: struct sockaddr *name;
18: int *namelen;
19: .fi
20: .SH DESCRIPTION
21: .I Getpeername
22: returns the name of the peer connected to
23: socket
24: .IR s .
25: The
26: .I namelen
27: parameter should be initialized to indicate
28: the amount of space pointed to by
29: .IR name .
30: On return it contains the actual size of the name
31: returned (in bytes).
32: The name is truncated if the buffer provided is too small.
33: .SH DIAGNOSTICS
34: A 0 is returned if the call succeeds, \-1 if it fails.
35: .SH ERRORS
36: The call succeeds unless:
37: .TP 15
38: [EBADF]
39: The argument \fIs\fP is not a valid descriptor.
40: .TP 15
41: [ENOTSOCK]
42: The argument \fIs\fP is a file, not a socket.
43: .TP 15
44: [ENOTCONN]
45: The socket is not connected.
46: .TP 15
47: [ENOBUFS]
48: Insufficient resources were available in the system
49: to perform the operation.
50: .TP 15
51: [EFAULT]
52: The
53: .I name
54: parameter points to memory not in a valid part of the
55: process address space.
56: .SH "SEE ALSO"
57: accept(2), bind(2), socket(2), getsockname(2)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.