Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ getsockname(3N) — UnixWare 2.01

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

bind(3N)

getpeername(3N)

socket(3N)






       getsockname(3N)                                      getsockname(3N)


       NAME
             getsockname - get socket name

       SYNOPSIS
             cc [options] file -lsocket -lnsl
             #include <sys/types.h>
             #include <sys/socket.h>
             int getsockname(int s, struct sockaddr *name, size_t *namelen);

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

          Files
             /usr/lib/locale/locale/LC_MESSAGES/uxnsl

          Return Values
             0 is returned if the call succeeds; -1 if it fails.

       ERRORS
             The call succeeds unless:

             EBADF   The argument s is not a valid descriptor.

             ENOTSOCK
                     The argument s is a file, not a socket.

             ENOMEM  There was insufficient user memory for the operation
                     to complete.

             ENOSR   There were insufficient STREAMS resources available
                     for the operation to complete.

       REFERENCES
             bind(3N), getpeername(3N), socket(3N)

       NOTICES
             The type of address structure passed to accept depends on the
             address family.  UNIX domain sockets (address family AF_UNIX)
             require a struct sockaddr_un structure as defined in sys/un.h;
             Internet domain sockets (address family AF_INET) require a
             struct sockaddr_in structure as defined in netinet/in.h.
             Other address families may require other structures.  Use the
             structure appropriate to the address family; cast the


                           Copyright 1994 Novell, Inc.               Page 1













      getsockname(3N)                                      getsockname(3N)


            structure address to a generic caddr_t in the call to
            getsockname and pass the size of the structure in the namelen
            argument.

            When the function issues an ioctl call that fails with ENXIO
            or EPIPE, it sets errno to 0 and returns, thus giving the
            impression that the function worked properly.  The function
            should return EPIPE for this condition.  However, if the
            function does not return the correct value for errno for this
            condition, the application will be unaware that the data in
            the returned buffer will be invalid.  If type is equal to
            LOCALNAME, then the address of the local side of the
            connection is returned; otherwise, the address of the remote
            side is returned.


































                          Copyright 1994 Novell, Inc.               Page 2








Typewritten Software • bear@typewritten.org • Edmonds, WA 98026