


TCPTLI(4P)                  PROTOCOLS                  TCPTLI(4P)



NAME
     tcptli - TLI-Conforming TCP Stream-Head

CONFIG
     pseudo-device clone

     pseudo-device tcptli32

SYNOPSIS
     #include <fcntl.h>
     #include <nettli/tiuser.h>

     tfd = t_open("/dev/tcp", O_RDWR, tinfo);
     struct t_info *tinfo;


DESCRIPTION
     TCPTLI provides access to  TCP  service  via  the  Transport
     Library  Interface  (TLI). Prior to this release, TCP access
     was only possible via the socket programming interface. Pro-
     grammers  have  the choice of using either the socket or TLI
     programming interface for their application.

     TCPTLI is implemented in STREAMS conforming to the Transport
     Provider  Interface  (TPI)  specification as a TCP Transport
     Provider to a TLI  application.  It  utilizes  the  existing
     underlying  socket  and  TCP  support in the SunOS kernel to
     communicate over the network.  It is also  a  clone  driver,
     see  clone(4) for more characteristics pertaining to a clone
     STREAMS driver.

     The notion of an address is the same as the  socket  address
     (struct  sockaddr_in)  defined  in  <netinet/in.h>.   TCPTLI
     maintains transport state information for  each  outstanding
     connection  and  the  current  state  of the provider may be
     retrieved via the t_getstate(3N)  call.  See  t_getstate(3N)
     for a list of possible states.

     A server usually starts up with the t_open(3N) call followed
     by  t_bind(3N) to bind an address that it listens for incom-
     ing connection. It may  call  t_listen(3N)  to  retrieve  an
     indication of a connect request from another transport user,
     and then calls t_accept(3N) if it is willing to provide  its
     service.  TLI  allows  a  server to accept connection on the
     same file descriptor it is listening on, or a different file
     descriptor (as in the sense of socket's accept(2) ).

     A client usually calls t_open(3N) and followed by a call  to
     t_bind(3N).  Then it calls t_connect(3N) to the address of a
     server advertized for providing service. Once the connection
     is  established,  it  may  use  t_rcv(3N)  and  t_snd(3N) to
     receive and send data.  The routine t_close(3N) is  used  to



Sun Release 4.1   Last change: 2 December 1989                  1






TCPTLI(4P)                  PROTOCOLS                  TCPTLI(4P)



     terminate the connection.

TLI ERRORS
     An TLI operation may fail if one of the following error con-
     ditions  is  encountered.  They are returned by the TLI user
     level library.

     TBADADDR            Incorrect/invalid  address  format  sup-
                         plied by the user.

     TBADOPT             Incorrect option.

     TACCESS             No permission.

     TBADF               Illegal transport file descriptor.

     TNOADDR             Could not allocate address

     TOUTSTATE           The transport is in an incorrect state.

     TBADSEQ             Incorrect sequence number.

     TSYSERR             A system error, i.e. below the transport
                         level (see list below) is encountered.

     TLOOK               An event requires attention.

     TBADDATA            Illegal amount of data

     TBUFOVFLW           Buffer not large enough.

     TFLOW               Flow control problem.

     TNODATA             No data.

     TNODIS              No discon_ind is found on the queue.

     TNOUDERR            Unit data not found.

     TBADFLAG            Bad flags.

     TNOREL              No  orderly  release  request  found  on
                         queue.

     TNOTSUPPORT         Protocol/primitive is not supported.

     TSTATECHNG          State is in the process of changing.

SYSTEM ERRORS
     The following errors are returned by  TCPTLI.  However  they
     may  be translated to the above TLI errors by the user level
     library ( libnsl ).



Sun Release 4.1   Last change: 2 December 1989                  2






TCPTLI(4P)                  PROTOCOLS                  TCPTLI(4P)



     ENXIO               Invalid device or address, out of range.

     EBUSY               Request device is busy or not ready.

     ENOMEM              Not enough memory for transmitting data,
                         non fatal.

     EPROTO              The operation encountered an  underlying
                         protocol.  error (TCP).

     EWOULDBLOCK         The operation would  block  as  normally
                         the  file  descriptors are set with non-
                         blocking flag.

     EACCES              Permission denied.

     ENOBUFS             The system ran out of memory for  inter-
                         nal (network) data structures.

SEE ALSO
     accept(2),    t_open(3N),     t_close(3N),     t_accept(3N),
     t_getstate(3N),    t_bind(3N),   t_connect(3N),   t_rcv(3N),
     t_snd(3N), t_alloc(3N), t_unbind(3N), t_getinfo(3N)

BUGS
     Only TCP (i.e. connection oriented) protocol  is  supported,
     no  UDP.  The maximum network connection is 32 by default. A
     new kernel has to be configured if an increase of such limit
     is  desired: by changing the entry pseudo-device tcptli32 in
     the kernel config file to tcptli64.

























Sun Release 4.1   Last change: 2 December 1989                  3



