Get the name of a socket
#include <sys/socket.h>
int getsockname( int s, 
                 struct sockaddr * name,
                 socklen_t * namelen );
- s
 
- The file descriptor of the socket whose name you want to get.
 
- name
 
- A pointer to a sockaddr object where the function can
  store the socket's name.
 
- namelen
 
- A pointer to a socklen_t object that initially 
  indicates the amount of space pointed to by name. 
  The function updates namelen to contain the actual size of the
  name (in bytes).
 
libsocket
Use the -l socket option to
qcc
to link against this library.
The getsockname() function returns the current name for the specified socket.
- 0
  
 
- Success.
  
 
- -1
  
 
- An error occurred 
    (errno
    is set).
 
- EBADF
  
 
- Invalid descriptor s.
  
 
- EFAULT
  
 
- The name parameter points to memory
      that isn't in a valid part of the process address space.
  
 
- ENOBUFS
  
 
- Insufficient resources were available in the system to
      perform the operation.
 
POSIX 1003.1
| Safety: |  | 
| Cancellation point | 
    Yes | 
| Interrupt handler | 
    No | 
| Signal handler | 
    No | 
| Thread | 
    Yes | 
getpeername()