1GETPEERNAME(2)                System Calls Manual               GETPEERNAME(2)
2
3
4

NAME

6       getpeername - get name of connected peer
7

SYNOPSIS

9       getpeername(s, name, namelen)
10       int s;
11       struct sockaddr *name;
12       int *namelen;
13

DESCRIPTION

15       Getpeername  returns  the  name of the peer connected to socket s.  The
16       namelen parameter should be initialized to indicate the amount of space
17       pointed  to by name.  On return it contains the actual size of the name
18       returned (in bytes).  The name is truncated if the buffer  provided  is
19       too small.
20

DIAGNOSTICS

22       A 0 is returned if the call succeeds, -1 if it fails.
23

ERRORS

25       The call succeeds unless:
26
27       [EBADF]        The argument s is not a valid descriptor.
28
29       [ENOTSOCK]     The argument s is a file, not a socket.
30
31       [ENOTCONN]     The socket is not connected.
32
33       [ENOBUFS]      Insufficient  resources  were available in the system to
34                      perform the operation.
35
36       [EFAULT]       The name parameter points to memory not in a valid  part
37                      of the process address space.
38

SEE ALSO

40       accept(2), bind(2), socket(2), getsockname(2)
41
42
43
444.2 Berkeley Distribution        May 13, 1986                   GETPEERNAME(2)
Impressum