1GETSOCKNAME(2)             Linux Programmer's Manual            GETSOCKNAME(2)
2
3
4

NAME

6       getsockname - get socket name
7

SYNOPSIS

9       #include <sys/socket.h>
10
11       int getsockname(int s, struct sockaddr *name, socklen_t *namelen);
12

DESCRIPTION

14       getsockname()  returns  the current name for the specified socket.  The
15       namelen parameter should be initialized to indicate the amount of space
16       pointed  to by name.  On return it contains the actual size of the name
17       returned (in bytes).
18

RETURN VALUE

20       On success, zero is returned.  On error, -1 is returned, and  errno  is
21       set appropriately.
22

ERRORS

24       EBADF  The argument s is not a valid descriptor.
25
26       EFAULT The  name  parameter points to memory not in a valid part of the
27              process address space.
28
29       EINVAL namelen is invalid (e.g., is negative).
30
31       ENOBUFS
32              Insufficient resources were available in the system  to  perform
33              the operation.
34
35       ENOTSOCK
36              The argument s is a file, not a socket.
37

CONFORMING TO

39       SVr4,  4.4BSD  (the  getsockname()  function  call appeared in 4.2BSD),
40       POSIX.1-2001.
41

NOTE

43       The third argument of getsockname() is in reality an `int *' (and  this
44       is  what  4.x  BSD  and  libc4  and  libc5 have).  Some POSIX confusion
45       resulted in the present  socklen_t,  also  used  by  glibc.   See  also
46       accept(2).
47

SEE ALSO

49       bind(2), socket(2)
50
51
52
53BSD Man Page                      1993-07-24                    GETSOCKNAME(2)
Impressum