VMS Help
TCPIP Services, Programming Interfaces, Sockets API, getsockname()

 *Conan The Librarian (sorry for the slow response - running on an old VAX)

    Returns the name associated with a socket.
    The $QIO equivalent is the IO$_SENSEMODE function with the p3
    argument.
    Format
      #include  <types.h>
      #include  <socket.h>
      int getsockname  ( int s, struct sockaddr *name, int *namelen
                       );

  1 - Arguments

 s
    A socket descriptor created with socket() function and bound to
    the socket name with the bind() function.
 name
    A pointer to the buffer in which getsockname() should return the
    socket name.
 namelen
    A pointer to an integer containing the size of the buffer pointed
    to by name. On return, the integer contains the actual size, in
    bytes, of the name returned.

  2 - Description

    This function returns the current name for the specified socket
    descriptor. The name is a format specific to the address family
    (AF_INET) assigned to the socket.
    The bind() function, not the getsockname()  function, makes the
    association of the name to the socket.
    Related Functions
    See also bind() and socket().

  3 - Return Values

    0                  Successful completion.
    -1                 Error; errno is set to indicate the error.

  4 - Errors

    EBADF              The descriptor is invalid.
    EFAULT             The name argument is not a valid part of the
                       user address space.
    ENOBUFS            The system has insufficient resources to
                       complete the call.
    ENOTSOCK           The socket descriptor is invalid.
    EOPNOTSUPP         The operation is not supported for this
                       socket's protocol.
  Close     HLB-list     TLB-list     Help  

[legal] [privacy] [GNU] [policy] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.