GETPEERNAME(2) System Calls Manual GETPEERNAME(2)NAME
getpeername - get name of connected peer
SYNOPSIS
getpeername(s, name, namelen)
int s;
struct sockaddr *name;
int *namelen;
DESCRIPTION
Getpeername returns the name of the peer connected to 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). The name is truncated if the buffer pro-
vided is too small.
DIAGNOSTICS
A 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.
[ENOTCONN] The socket is not connected.
[ENOBUFS] Insufficient resources were available in the system to perform the operation.
[EFAULT] The name parameter points to memory not in a valid part of the process address space.
SEE ALSO accept(2), bind(2), socket(2), getsockname(2)4.2 Berkeley Distribution May 13, 1986 GETPEERNAME(2)
Check Out this Related Man Page
GETPEERNAME(2) Linux Programmer's Manual GETPEERNAME(2)NAME
getpeername - get name of connected peer socket
SYNOPSIS
#include <sys/socket.h>
int getpeername(int s, struct sockaddr *name, socklen_t *namelen);
DESCRIPTION
Getpeername returns the name of the peer connected to 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). The name is truncated if the buffer pro-
vided is too small.
RETURN VALUE
On success, zero is returned. On error, -1 is returned, and errno is set appropriately.
ERRORS
EBADF The argument s is not a valid descriptor.
ENOTSOCK
The argument s is a file, not a socket.
ENOTCONN
The socket is not connected.
ENOBUFS
Insufficient resources were available in the system to perform the operation.
EFAULT The name parameter points to memory not in a valid part of the process address space.
CONFORMING TO
SVr4, 4.4BSD (the getpeername function call first appeared in 4.2BSD).
NOTE
The third argument of getpeername is in reality an `int *' (and this is what BSD 4.* and libc4 and libc5 have). Some POSIX confusion
resulted in the present socklen_t. The draft standard has not been adopted yet, but glibc2 already follows it and also has socklen_t. See
also accept(2).
SEE ALSO accept(2), bind(2), getsockname(2)BSD Man Page 1993-07-30 GETPEERNAME(2)
When I worked with client-server (socket) programming, I encountered "the socket error# 10055" which means "No buffer space available". This might be a symptom of one or more applications that didn't return system resources (like memory) properly. Temporary solution was to reboot the machine to... (7 Replies)
Morning,
I've installed a new p550 into a rack and connected it up to the HMC but the HMC cannot find it, I don't understand why it's not?
Has anyone else had this problem before?
Thanks
Kees (4 Replies)
hello socket programming expert,
I having difficulties in understanding how select() function in socket programming work.... I'm trying to create my own peer-to-peer chat or file transfer program by using the select() function.... Therefore does anyone had any tutorial or source code that... (4 Replies)
Hi
My socket program is to communicate between the two systems connected with lan. Always i am getting an error saying bind value is -1 or not connected. ..If i run both the server and client programs in the same machine in two diff terminals they are working but they are not working between two... (3 Replies)