Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

16.9.4 Who is Connected to Me?

— Function: int getpeername (int socket, struct sockaddr *addr, socklen_t *length-ptr)

The getpeername function returns the address of the socket that socket is connected to; it stores the address in the memory space specified by addr and length-ptr. It stores the length of the address in *length-ptr.

See Socket Addresses, for information about the format of the address. In some operating systems, getpeername works only for sockets in the Internet domain.

The return value is 0 on success and -1 on error. The following errno error conditions are defined for this function:

EBADF
The argument socket is not a valid file descriptor.
ENOTSOCK
The descriptor socket is not a socket.
ENOTCONN
The socket socket is not connected.
ENOBUFS
There are not enough internal buffers available.


 
 
  Published under the terms of the GNU General Public License Design by Interspire