home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3n / socket.z / socket
Encoding:
Text File  |  1998-10-20  |  11.8 KB  |  199 lines

  1.  
  2.  
  3.  
  4. ssssoooocccckkkkeeeetttt((((3333NNNN))))                                                          ssssoooocccckkkkeeeetttt((((3333NNNN))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      _ssss_oooo_cccc_kkkk_eeee_tttt - create an endpoint for communication
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_tttt_yyyy_pppp_eeee_ssss_...._hhhh_>>>>
  13.      _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_ssss_oooo_cccc_kkkk_eeee_tttt_...._hhhh_>>>>
  14.  
  15.      _iiii_nnnn_tttt _ssss_oooo_cccc_kkkk_eeee_tttt_((((_iiii_nnnn_tttt _dddd_oooo_mmmm_aaaa_iiii_nnnn_,,,, _iiii_nnnn_tttt _tttt_yyyy_pppp_eeee_,,,, _iiii_nnnn_tttt _pppp_rrrr_oooo_tttt_oooo_cccc_oooo_llll_))))_;;;;
  16.  
  17. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  18.      _ssss_oooo_cccc_kkkk_eeee_tttt creates an endpoint for communication and returns a descriptor.
  19.  
  20.      The _d_o_m_a_i_n parameter specifies a communications domain within which
  21.      communication will take place; this selects the protocol family which
  22.      should be used.  The protocol family generally is the same as the address
  23.      family for the addresses supplied in later operations on the socket.
  24.      These families are defined in the include file _ssss_yyyy_ssss_////_ssss_oooo_cccc_kkkk_eeee_tttt_...._hhhh.  There must
  25.      be an entry in the _nnnn_eeee_tttt_cccc_oooo_nnnn_ffff_iiii_gggg(4) file for at least each protocol family
  26.      and type required.  If _p_r_o_t_o_c_o_l has been specified, but no exact match
  27.      for the tuplet family, type, protocol is found, then the first entry
  28.      containing the specified family and type with zero for protocol will be
  29.      used.  The currently understood formats are:
  30.  
  31.      _PPPP_FFFF______UUUU_NNNN_IIII_XXXX             UNIX system internal protocols
  32.  
  33.      _PPPP_FFFF______IIII_NNNN_EEEE_TTTT             ARPA Internet protocols
  34.  
  35.      The socket has the indicated _t_y_p_e, which specifies the communication
  36.      semantics.  Currently defined types are:
  37.  
  38.           _SSSS_OOOO_CCCC_KKKK______SSSS_TTTT_RRRR_EEEE_AAAA_MMMM
  39.           _SSSS_OOOO_CCCC_KKKK______DDDD_GGGG_RRRR_AAAA_MMMM
  40.           _SSSS_OOOO_CCCC_KKKK______RRRR_AAAA_WWWW
  41.           _SSSS_OOOO_CCCC_KKKK______SSSS_EEEE_QQQQ_PPPP_AAAA_CCCC_KKKK_EEEE_TTTT
  42.           _SSSS_OOOO_CCCC_KKKK______RRRR_DDDD_MMMM
  43.  
  44.      A _SSSS_OOOO_CCCC_KKKK______SSSS_TTTT_RRRR_EEEE_AAAA_MMMM type provides sequenced, reliable, two-way connection-based
  45.      byte streams.  An out-of-band data transmission mechanism may be
  46.      supported.  A _SSSS_OOOO_CCCC_KKKK______DDDD_GGGG_RRRR_AAAA_MMMM socket supports datagrams (connectionless,
  47.      unreliable messages of a fixed (typically small) maximum length).  A
  48.      _SSSS_OOOO_CCCC_KKKK______SSSS_EEEE_QQQQ_PPPP_AAAA_CCCC_KKKK_EEEE_TTTT socket may provide a sequenced, reliable, two-way
  49.      connection-based data transmission path for datagrams of fixed maximum
  50.      length; a consumer may be required to read an entire packet with each
  51.      read system call.  This facility is protocol specific, and presently not
  52.      implemented for any protocol family.  _SSSS_OOOO_CCCC_KKKK______RRRR_AAAA_WWWW sockets provide access to
  53.      internal network interfaces.  The types _SSSS_OOOO_CCCC_KKKK______RRRR_AAAA_WWWW, which is available only
  54.      to a privileged user, and _SSSS_OOOO_CCCC_KKKK______RRRR_DDDD_MMMM, for which no implementation currently
  55.      exists, are not described here.
  56.  
  57.      _p_r_o_t_o_c_o_l specifies a particular protocol to be used with the socket.
  58.      Normally only a single protocol exists to support a particular socket
  59.      type within a given protocol family.  However, multiple protocols may
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. ssssoooocccckkkkeeeetttt((((3333NNNN))))                                                          ssssoooocccckkkkeeeetttt((((3333NNNN))))
  71.  
  72.  
  73.  
  74.      exist, in which case a particular protocol must be specified in this
  75.      manner.  The protocol number to use is particular to the "communication
  76.      domain" in which communication is to take place.  If a protocol is
  77.      specified by the caller, then it will be packaged into a socket level
  78.      option request and sent to the underlying protocol layers.
  79.  
  80.      Sockets of type _SSSS_OOOO_CCCC_KKKK______SSSS_TTTT_RRRR_EEEE_AAAA_MMMM are full-duplex byte streams, similar to
  81.      pipes.  A stream socket must be in a _c_o_n_n_e_c_t_e_d state before any data may
  82.      be sent or received on it.  A connection to another socket is created
  83.      with a _cccc_oooo_nnnn_nnnn_eeee_cccc_tttt(3N) call.  Once connected, data may be transferred using
  84.      _rrrr_eeee_aaaa_dddd(2) and _wwww_rrrr_iiii_tttt_eeee(2) calls or some variant of the _ssss_eeee_nnnn_dddd(3N) and _rrrr_eeee_cccc_vvvv(3N)
  85.      calls.  When a session has been completed, a _cccc_llll_oooo_ssss_eeee(2) may be performed.
  86.      Out-of-band data may also be transmitted as described on the _ssss_eeee_nnnn_dddd(3N)
  87.      manual page and received as described on the _rrrr_eeee_cccc_vvvv(3N) manual page.
  88.  
  89.      The communications protocols used to implement a _SSSS_OOOO_CCCC_KKKK______SSSS_TTTT_RRRR_EEEE_AAAA_MMMM insure that
  90.      data is not lost or duplicated.  If a piece of data for which the peer
  91.      protocol has buffer space cannot be successfully transmitted within a
  92.      reasonable length of time, then the connection is considered broken and
  93.      calls will indicate an error with -1 returns and with _EEEE_TTTT_IIII_MMMM_EEEE_DDDD_OOOO_UUUU_TTTT as the
  94.      specific code in the global variable _eeee_rrrr_rrrr_nnnn_oooo.  The protocols optionally
  95.      keep sockets "warm" by forcing transmissions roughly every minute in the
  96.      absence of other activity.  An error is then indicated if no response can
  97.      be elicited on an otherwise idle connection for a extended period (for
  98.      instance 5 minutes).  A _SSSS_IIII_GGGG_PPPP_IIII_PPPP_EEEE signal is raised if a process sends on a
  99.      broken stream; this causes naive processes, which do not handle the
  100.      signal, to exit.
  101.  
  102.      _SSSS_OOOO_CCCC_KKKK______SSSS_EEEE_QQQQ_PPPP_AAAA_CCCC_KKKK_EEEE_TTTT sockets employ the same system calls as _SSSS_OOOO_CCCC_KKKK______SSSS_TTTT_RRRR_EEEE_AAAA_MMMM
  103.      sockets.  The only difference is that _rrrr_eeee_aaaa_dddd calls will return only the
  104.      amount of data requested, and any remaining in the arriving packet will
  105.      be discarded.
  106.  
  107.      _SSSS_OOOO_CCCC_KKKK______DDDD_GGGG_RRRR_AAAA_MMMM and _SSSS_OOOO_CCCC_KKKK______RRRR_AAAA_WWWW sockets allow datagrams to be sent to
  108.      correspondents named in _ssss_eeee_nnnn_dddd_tttt_oooo calls.  Datagrams are generally received
  109.      with _rrrr_eeee_cccc_vvvv_ffff_rrrr_oooo_mmmm, which returns the next datagram with its return address.
  110.  
  111.      An _ffff_cccc_nnnn_tttt_llll(2) call can be used to specify a process group to receive a
  112.      _SSSS_IIII_GGGG_UUUU_RRRR_GGGG signal when the out-of-band data arrives.  It may also enable
  113.      non-blocking I/O and asynchronous notification of I/O events with _SSSS_IIII_GGGG_IIII_OOOO
  114.      signals.
  115.  
  116.      The operation of sockets is controlled by socket level _o_p_t_i_o_n_s.  These
  117.      options are defined in the file _////_uuuu_ssss_rrrr_////_iiii_nnnn_cccc_llll_uuuu_dddd_eeee_////_ssss_yyyy_ssss_////_ssss_oooo_cccc_kkkk_eeee_tttt_...._hhhh.
  118.      _ssss_eeee_tttt_ssss_oooo_cccc_kkkk_oooo_pppp_tttt(3N) and _gggg_eeee_tttt_ssss_oooo_cccc_kkkk_oooo_pppp_tttt(3N) are used to set and get options,
  119.      respectively.
  120.  
  121. RRRREEEETTTTUUUURRRRNNNN VVVVAAAALLLLUUUUEEEE
  122.      A -1 is returned if an error occurs.  Otherwise the return value is a
  123.      descriptor referencing the socket.
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. ssssoooocccckkkkeeeetttt((((3333NNNN))))                                                          ssssoooocccckkkkeeeetttt((((3333NNNN))))
  137.  
  138.  
  139.  
  140. EEEERRRRRRRROOOORRRRSSSS
  141.      The _ssss_oooo_cccc_kkkk_eeee_tttt_((((_)))) call fails if:
  142.  
  143.      _EEEE_PPPP_RRRR_OOOO_TTTT_OOOO_NNNN_OOOO_SSSS_UUUU_PPPP_PPPP_OOOO_RRRR_TTTT     The protocol type or the specified protocol is not
  144.                          supported within this domain.
  145.  
  146.      _EEEE_MMMM_FFFF_IIII_LLLL_EEEE              The per-process descriptor table is full.
  147.  
  148.      _EEEE_AAAA_CCCC_CCCC_EEEE_SSSS_SSSS             Permission to create a socket of the specified type
  149.                          and/or protocol is denied.
  150.  
  151.      _EEEE_NNNN_OOOO_MMMM_EEEE_MMMM              Insufficient user memory is available.
  152.  
  153.      _EEEE_NNNN_OOOO_SSSS_RRRR               There were insufficient STREAMS resources available
  154.                          to complete the operation.
  155.  
  156. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  157.      _cccc_llll_oooo_ssss_eeee(2), _ffff_cccc_nnnn_tttt_llll(2), _iiii_oooo_cccc_tttt_llll(2), _rrrr_eeee_aaaa_dddd(2), _wwww_rrrr_iiii_tttt_eeee(2), _aaaa_cccc_cccc_eeee_pppp_tttt(3N), _bbbb_iiii_nnnn_dddd(3N),
  158.      _cccc_oooo_nnnn_nnnn_eeee_cccc_tttt(3N), _gggg_eeee_tttt_ssss_oooo_cccc_kkkk_nnnn_aaaa_mmmm_eeee(3N), _gggg_eeee_tttt_ssss_oooo_cccc_kkkk_oooo_pppp_tttt(3N), _llll_iiii_ssss_tttt_eeee_nnnn(3N), _rrrr_eeee_cccc_vvvv(3N),
  159.      _ssss_eeee_nnnn_dddd(3N), _ssss_hhhh_uuuu_tttt_dddd_oooo_wwww_nnnn(3N), _ssss_oooo_cccc_kkkk_eeee_tttt_pppp_aaaa_iiii_rrrr(3N)
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.