Pegasus InfoCorp: Web site design and web software development company

SOCKET (4)

Linux socket interface

SYNOPSIS

    #include <sys/socket.h> mysocket = socket(int socket_family, int socket_type, int protocol);

DESCRIPTION

    This man page describes the BSD compatible Linux networking sockets layer. The sockets layer is the uniform interface between the user process and the in kernel network protocol stacks. The protocol modules are grouped into protocol families like PF_INET, PF_IPX, PF_PACKET and socket types like SOCK_RAW or SOCK_DGRAM. See socket (2) for more information.

SOCKET LAYER FUNCTIONS

    These functions are used by the user process to send or receive packets and to do other socket operations. For more information see their man pages.

    socket (2) creates a socket, connect (2) connects a socket to a foreign socket address, the bind (2) function binds a socket to a local socket address, listen (2) tells the socket that new connections will be accepted, and accept (2) is used to get a new socket with the new connection. socketpair (2) returns two connected anonymous sockets.

    send (2), sendto (2), and sendmsg (2) send data over a socket, and recv (2), recvfrom (2), recvmsg (2) receive data from a socket. poll (2) and select (2) wait for arriving data or a readiness to send data. In addition, the standard I/O operations like write (2), writev (2), read (2), and readv (2) can be used to read and write data.

    getsockname (2) returns the local socket address and getpeername (2) returns the foreign socket address. getsockopt (2) and setsockopt (2) are used to set or get socket layer or protocol options. ioctl (2) can be used to set or read some other options.

    close (2) is used to close a socket. shutdown (2) closes parts of a full duplex socket connection.

    Seeking is not supported on sockets.