[Previous] [Contents] [Index] [Next]

getsockname()

Get the name of a socket

Synopsis:

#include <sys/socket.h>

int getsockname( int s, 
                 struct sockaddr * name, 
                 size_t * namelen );

Library:

socket3r.lib, socket3s.lib

Description:

The getsockname() function returns the current name for the specified socket. The namelen parameter indicates the amount of space pointed to by name. On return, namelen contains the actual size of the name (in bytes).

Returns:

0
Success.
-1
An error occurred (errno is set).

Errors:

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.

Classification:

Standard Unix, POSIX 1003.1g (draft)

Safety:
Interrupt handler No
Signal handler No
Thread Yes

See also:

getpeername()


[Previous] [Contents] [Index] [Next]