1getsockname(3SOCKET)       Sockets Library Functions      getsockname(3SOCKET)
2
3
4

NAME

6       getsockname - get socket name
7

SYNOPSIS

9       cc [ flag ... ] file ... -lsocket  -lnsl  [ library ... ]
10       #include <sys/types.h>
11       #include <sys/socket.h>
12
13       int getsockname(int s, struct sockaddr *name, socklen_t *namelen);
14
15

DESCRIPTION

17       getsockname() returns the current name for socket s. The namelen param‐
18       eter should be initialized to indicate the amount of space  pointed  to
19       by  name.  On  return  it contains the actual size in bytes of the name
20       returned.
21

RETURN VALUES

23       If successful, getsockname() returns  0; otherwise it returns   −1  and
24       sets  errno to indicate the error.
25

ERRORS

27       The call succeeds unless:
28
29       EBADF       The argument s is not a valid file descriptor.
30
31
32       ENOMEM      There  was  insufficient memory available for the operation
33                   to complete.
34
35
36       ENOSR       There were insufficient STREAMS resources available for the
37                   operation to complete.
38
39
40       ENOTSOCK    The argument s is not a socket.
41
42

ATTRIBUTES

44       See attributes(5) for descriptions of the following attributes:
45
46
47
48
49       ┌─────────────────────────────┬─────────────────────────────┐
50       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
51       ├─────────────────────────────┼─────────────────────────────┤
52       │MT-Level                     │Safe                         │
53       └─────────────────────────────┴─────────────────────────────┘
54

SEE ALSO

56       bind(3SOCKET), getpeername(3SOCKET), socket(3SOCKET), attributes(5)
57
58
59
60SunOS 5.11                        12 Dec 1997             getsockname(3SOCKET)
Impressum