Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/g/getpeername.html on line 1
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/g/getpeername.html on line 1
Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/g/getpeername.html on line 8
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/g/getpeername.html on line 8
Get the name of the peer connected to a socket
#include <sys/socket.h>
int getpeername( int s,
struct sockaddr * name,
socklen_t * namelen );
- s
- The socket whose connected peer you want to get.
- name
- A buffer where the function can store the name of the peer.
- namelen
- A pointer to a socklen_t object that initially specifies the
size of the buffer.
This function stores the actual size of the name, in bytes, in this object.
libsocket
Use the -l socket option to
qcc
to link against this library.
The getpeername() function returns the name of
the peer connected to socket s.
The name is truncated if the buffer provided is too small.
- 0
- Success.
- -1
- An error occurred
(errno
is set).
- EBADF
- Invalid descriptor s.
- EFAULT
- The name parameter points to memory
not in a valid part of the process address space.
- ENOBUFS
- Insufficient resources were available in the system to
perform the operation.
- ENOTCONN
- The socket isn't connected.
POSIX 1003.1
Safety: | |
Cancellation point |
Yes |
Interrupt handler |
No |
Signal handler |
No |
Thread |
Yes |
accept(),
bind(),
getsockname(),
socket()
Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/g/getpeername.html on line 166
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/g/getpeername.html on line 166