ssoocckkeett() -- Sockets Function (libsocket)

Create a socket
#iinncclluuddee <ssyyss/ttyyppeess.hh>
#iinncclluuddee <ssyyss/ssoocckkeett.hh>
iinntt ssoocckkeett(_d_o_m_a_i_n, _t_y_p_e, _p_r_o_t_o_c_o_l)
iinntt _d_o_m_a_i_n, _t_y_p_e, _p_r_o_t_o_c_o_l;

ssoocckkeett() creates  a ``socket'' --  that is, an  endpoint for communication.
It returns a descriptor that uniquely identifies the socket.

_d_o_m_a_i_n  specifies the  domain within which  communication will  take place.
This selects the protocol family to be used.  These families are defined in
<ssyyss/ssoocckkeett.hh> Currently, ssoocckkeett() recognizes the following domains:

AAFF_UUNNIIXX   UNIX internal protocols.
AAFF_IINNEETT   ARPA Internet protocols.

The  socket  has  the indicated  _t_y_p_e,  which  specifies  the semantics  of
communication.  ssoocckkeett() recogizes the following types:

SSOOCCKK_SSTTRREEAAMM
          This  type provides  a byte stream  that is  sequenced, reliable,
          two-way, and connection-based.

SSOOCCKK_DDGGRRAAMM
          This  type  supports ``datagrams''  --  that is,  connectionless,
          unreliable messages of a fixed maximum length.

_p_r_o_t_o_c_o_l identifies the protocol to  be used with the newly created socket.
In  most instances,  a given  type  of socket  supports only  one protocol.
However, a socket type may  support many different protocols, in which case
you must specify the one to  use.  The protocol number to use is particular
to the ``communication domain'' in which communication is to take place.

Sockets of type SSOOCCKK_SSTTRREEAAMM are full-duplex byte streams, similar to pipes.
A stream socket must be in a connected to another socket (through a call to
function ccoonnnneecctt())  before any data can  be sent to it  or received on it.
Once connected,  data can be transferred using the  system calls rreeaadd() and
wwrriittee(). When a session has  been completed, invoke the system call cclloossee()
to close the socket.

If  all goes  well, ssoocckkeett()  returns the descriptor  of the  newly created
socket; this  is always  a positive integer.   If something goes  wrong, it
returns -1 and sets eerrrrnnoo to an appropriate value.  The following lists the
possible errors, by the value to which ssoocckkeett() sets eerrrrnnoo:

EEPPRROOTTOONNOOSSUUPPPPOORRTT
     _t_y_p_e or _p_r_o_t_o_c_o_l is not supported within this domain.

EEMMFFIILLEE
     The per-process descriptor table is full.

EENNFFIILLEE
     The system file table is full.

EEAACCCCEESSSS
     You  do not  have permission  to create  a socket of  a given  _t_y_p_e or
     _p_r_o_t_o_c_o_l.

EENNOOBBUUFFSS
     Not enough  buffer space is  available.  The socket  cannot be created
     until sufficient resources are freed.

_S_e_e _A_l_s_o
aacccceepptt(), ccoonnnneecctt(), lliibbssoocckkeett, lliisstteenn(), rreeaadd(), wwrriittee()
