Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

sockstat(1) [opendarwin man page]

SOCKSTAT(1)                                                 BSD General Commands Manual                                                SOCKSTAT(1)

NAME
sockstat -- list open sockets SYNOPSIS
sockstat [-clh] [-p ports] [-P pid|process] [-U uid|user] [-G gid|group] DESCRIPTION
The sockstat command lists open Internet or UNIX domain sockets. The following options are available: -c Show connected sockets. -l Show listening sockets. -h Show a usage summary. -p ports Only show Internet sockets if either the local or foreign port number is on the specified list. The ports argument is a comma- separated list of port numbers and ranges specified as first and last port separated by a dash. -P pid|process Only show sockets of the specified pid|process. The pid|process argument is a process name or pid. -U uid|user Only show sockets of the specified uid|user. The uid|user argument is a username or uid. -G gid|group Only show sockets of the specified gid|group. The gid|group argument is a groupname or gid. If neither -c or -l is specified, sockstat will list both listening and connected sockets. The information listed for each socket is: USER The user who owns the socket. COMMAND The command which holds the socket. PID The process ID of the command which holds the socket. FD The file descriptor number of the socket. PROTO The transport protocol associated with the socket for Internet sockets, or the type of socket (stream or datagram) for UNIX sockets. LOCAL ADDRESS For Internet sockets, this is the address the local end of the socket is bound to (see getsockname(2)). For bound UNIX sockets, it is the socket's filename. For other UNIX sockets, it is a right arrow followed by the endpoint's filename, or ``??'' if the endpoint could not be determined. FOREIGN ADDRESS (Internet sockets only) The address the foreign end of the socket is bound to (see getpeername(2)). SEE ALSO
netstat(1), protocols(5) HISTORY
The sockstat command appeared in FreeBSD 3.1. AUTHORS
The sockstat command and this manual page were written by Dag-Erling Smorgrav <des@FreeBSD.org>. The sockstat command was ported to Linux by William Pitcock <nenolod@nenolod.net>. BSD May 18, 2008 BSD

Check Out this Related Man Page

socketpair(2)							System Calls Manual						     socketpair(2)

NAME
socketpair - Creates a pair of connected sockets SYNOPSIS
#include <sys/socket.h> int socketpair( int domain, int type, int protocol, int socket_vector[2] ); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: socketpair(): XNS5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Specifies the communications domain in which the sockets are created. This function does not create sockets in the Internet domain. Speci- fies the communications method that sockets use, for example SOCK_DGRAM or SOCK_STREAM. Specifies an optional identifier used to define the communications protocols used in the transport layer interface. Specifies a two-integer array used to hold the file descriptors of the socket pair created with the call to this function. DESCRIPTION
The socketpair() function creates an unnamed pair of connected sockets in a specified domain, of a specified type, under the protocol optionally specified by the protocol parameter. The two sockets are identical. The file descriptors used in referencing the created sock- ets are returned to socket_vector[0] and socket_vector[1]. The sys/socket.h include file contains definitions for socket domains, types, and protocols. Not all protocol families support the socketpair() function. RETURN VALUES
Upon successful completion, this function returns a value of 0 (zero). Otherwise, -1 is returned and errno is specified to indicate the error. ERRORS
If the socketpair() function fails, errno may be set to one of the following values: The process have not have appropriate privileges. The addresses in the specified address family cannot be used to create this socket pair. [Tru64 UNIX] The socket_vector array is not located in a writable part of user address space. The current process has too many open file descriptors. No more file descriptors are available for the system. Insufficient resources were available in the system to complete the call. The system was unable to allocate kernel memory to increase the process descriptor table. The available STREAMS resources were insufficient for the operation to complete. The specified protocol does not permit creation of socket pairs. The specified protocol cannot be used in this system. The socket type is not supported by the protocol. RELATED INFORMATION
Functions: socket(2) Standards: standards(5) delim off socketpair(2)
Man Page