Oracle® Solaris 11.2 Programming Interfaces Guide

Exit Print View

Updated: July 2014
 
 

Overview of Sockets

Sockets have been an integral part of SunOS releases since 1981. A socket is an endpoint of communication to which a name can be bound. A socket has a type and an associated process. Sockets were designed to implement the client-server model for interprocess communication where:

  • The interface to network protocols needs to accommodate multiple communication protocols, such as TCP/IP, Xerox internet protocols (XNS), and the UNIX family.

  • The interface to network protocols needs to accommodate server code that waits for connections and client code that initiates connections.

  • Operations differ depending on whether communication is connection-oriented or connectionless.

  • Application programs might want to specify the destination address of the datagrams that are being delivered instead of binding the address with the open(2) call.

Sockets make network protocols available while behaving like UNIX files. Applications create sockets as sockets are needed. Sockets work with the close(2), read(2), write(2), ioctl(2), and fcntl(2) interfaces. The operating system differentiates between the file descriptors for files and the file descriptors for sockets.