Chapter 1: Developing network-based applications

Table of contents

Chapter 1

Developing network-based applications

The SCO OpenServer Development System includes libraries that are useful in developing applications that work with various network-oriented communication protocols. These libraries implement the following Application Programming Interfaces (APIs):

These APIs give application programs access to Using these APIs, programmers can develop

About the APIs

This section describes the following APIs in the SCO OpenServer Development System: sockets, TLI, XTI, RPC, XDR, and the interfaces to NIS, SMUX, and SAPD.

Sockets

Sockets is an API that provides a framework for communication between processes executing either on the same host or across a network. A socket is the basic building block for communication, providing an endpoint to which a name may be bound. Sockets are created within a communications domain (Internet or UNIX) in the same way that files are created within a filesystem. Sockets are bidirectional, providing a two-way flow of data between processes that may or may not have the same parent and may or may not live on the same host.

The SCO sockets library is a 4.3BSD-compatible socket library that can be used to access the protocols provided with SCO TCP/IP: TCP, UDP, and IP. Both the AF_INET and AF_UNIX socket families are supported. 

Table 1-1 Socket library routines (SLIB)

      -----------------------------------------------------------------
      Routine           Description
      -----------------------------------------------------------------
      bstring           byte and byte string operations
      byteorder         convert values between host and network byte
                        order
      getdtablesize     get descriptor table size
      gethostbyname     get network host entry
      gethostname       get/set name of current host
      getnetent         get network entry
      getprotoent       get protocol entry
      getservent        get service entry
      gettimeofday      get date and time
      inet              Internet address manipulation routines
      insque            insert/remove element from a queue
      killpg            send signal to a process group
      perror            system error messages
      rcmd              routines to return a stream to a remote command
      resolver          resolver routines
      rexec             return stream to a remote command
      string            4.3 BSD string operations
      syslog            control system log
      wait3             wait for process to terminate or stop


Table 1-2 Socket system calls (SSC)

         ------------------------------------------------------------
         System call       Description
         ------------------------------------------------------------
         accept            accept a connection on a socket
         adjtime           correct the time to allow for
                           synchronization of the system clock
         bind              bind a name to a socket
         connect           initiate a connection on a socket
         getpeername       get name of connected peer
         getsockname       get socket name
         getsockopt        get and set options on sockets
         listen            listen for connections on a socket
         recv              receive a message from a socket
         select            synchronous I/O multiplexing
         send              send a message to a socket
         shutdown          shut down part of a full-duplex connection
         socket            create an endpoint for communication

TLI and XTI

TLI (Transport Layer Interface) is an API developed by AT&T® for the creation of distributed applications that can be easily ported to run over different transports. XTI (X/Open Transport Interface) is an extension to and refinement of TLI developed by the X/Open Company Ltd.



Table 1-3 TLI and XTI library routines (NET)

               ------------------------------------------------
               Routine           Description
               ------------------------------------------------
               t_accept          accept a connect request
               t_alloc           allocate a library structure
               t_bind            bind an address to a transport
                                 endpoint
               t_close           close a transport endpoint
               t_connect         establish a connection with
                                 another transport user
               t_error           produce error message
               t_free            free a library structure
               t_getinfo         get protocol-specific service
                                 information
               t_getstate        get the current state
               t_listen          listen for a connect request
               t_look            look at the current event on a
                                 transport endpoint
               t_open            establish a transport endpoint
               t_optmgmt         manage options for a transport
                                 endpoint
               t_rcv             receive data or expedited data
                                 sent over a connection
               t_rcvconnect      receive the confirmation from
                                 a connect request
               t_rcvudata        receive a data unit
               t_rcvuderr        receive a unit data error
                                 indication
               t_rcvdis          retrieve information from
                                 disconnect
               t_rcvrel          acknowledge receipt of an
                                 orderly release indication
               t_snd             send data or expedited data
                                 over a connection
               t_snddis          send user-initiated disconnect
                                 request
               t_sndrel          initiate an orderly release
               t_sndudata        send a data unit
               t_sync            synchronize transport library
               t_unbind          disable a transport endpoint

TLI can be used to access the TCP/IP and IPX/SPX transports. XTI can be used to access the TCP/IP and NetBIOS transports.

About the protocols and services

This section describes the protocols and services that programs can access using the APIs described in the Network Programming Interfaces: TCP/IP, NFS, NIS, IPX/SPX, SAPD, NetBIOS, and SMUX.

TCP/IP

TCP/IP is a set of communications protocols for both connection-oriented and connection-less communications that are independent of the underlying network hardware technology. 

Table 1-4 SCO TCP/IP protocols

           -------------------------------------------------------
           Protocol          Description
           -------------------------------------------------------
           TCP               Transmission Control Protocol
           UDP               User Datagram Protocol
           IP                Internet Protocol
           ARP               Address Resolution Protocol
           ICMP              Internet Control Message Protocol
           RIP               Routing Information Protocol
           PPP               Point to Point Protocol
           SLIP              Serial Line IP STREAMS module
           SMTP              Simple Mail Transfer Protocol
           Loopback          Loopback and test STREAMS module
           BIND              Berkeley Internet Domain name service

Applications developed with the SCO OpenServer Development System use either TLI, XTI, or sockets to communicate over TCP/IP.

NFS

NFS is a distributed file system for heterogeneous networks. With NFS, a user sees a single local directory hierarchy, even though many, if not most, of the files and directories in that hierarchy are located on other computers on the network. Applications that make Remote Procedure Calls (RPCs) use NFS to communicate with the remote processes that execute those calls.

The components of the SCO OpenServer Development System that support the development of RPC-based applications include:

RPC
The Remote Procedure Call API allows remote procedures to be invoked as if they were local subroutines. Using RPC, a process running on one machine can call a procedure that is executed by another process running on a different machine on the network.

XDR
The eXternal Data Representation API provides a system-independent and machine-independent format for data representation. Such a format allows data to be transmitted anywhere in a heterogeneous network.

RPCGEN
This tool generates C language code to implement the specific RPC semantics of the remote procedure calls in an application program.


Table 1-5 Network System Services library routines for NFS (NS)

     -------------------------------------------------------------------
     Routine                                   Description
     -------------------------------------------------------------------
     bindresvport                              bind a socket to a
                                               privileged IP port
     dbm, dbminit, fetch, store, delete,       database subroutines
     firstkey, nextkey 
     exportfs                                  export directory trees
     fh_fcntl                                  fcntl given NFS file
                                               handle
     getdomainname, setdomainname              get/set name of current
                                               domain
     getrpcent, getrpcbyname, getrpcbynumber   get RPC entry
     getrpcport                                get RPC port number
     kclt_create                               create kernel RPC client
                                               handles
     lstat                                     get file status
     ndbm, dbm_open, dbm_close, dbm_fetch,     database subroutines
     dbm_store, dbm_delete, dbm_firstkey,
     dbm_nextkey, dbm_error, dbm_clearerr 
     nfs_getfh                                 get NFS file handle
     nfs_svc, async_daemons                    NFS daemons
     rex                                       remote execution protocol
     rpc                                       library routines for
                                               remote procedure calls
     rwall                                     write to specified remote
                                               machines
     xdr                                       library routines for
                                               external data
                                               representation
Applications developed with the SCO OpenServer Development System use the library routines listed in Table 1-5, ``Network System Services library routines for NFS (NS)'' to communicate over NFS.

NIS

Network Information Service (NIS) is a networked system administration service that supplements NFS (Network File System). NIS ensures the consistency of system administration information in a heterogeneous network environment by designating a single host as the master for all the files and databases containing the information, and by distributing the information to all other hosts on the network. 

Table 1-6 Network System Services library routines for NIS (NS)

               ------------------------------------------------
               Routine                Description
               ------------------------------------------------
               ypclnt                 NIS client interface
               yppasswd               update user password in
                                      NIS
Applications developed with the SCO OpenServer Development System use the library routines listed in Table 1-6, ``Network System Services library routines for NIS (NS)'' to communicate with NIS.

IPX/SPX

IPX/SPX is a suite of network protocols defined by Novell® Corporation, and used as the transport provider in NetWare networks. 

Table 1-7 SCO IPX/SPX protocols

               ------------------------------------------------
               Protocol          Description
               ------------------------------------------------
               IPX               Internetwork Packet Exchange
               SPX               Sequence Packet Exchange
               SAP               Service Advertising Protocol
               RIP               Routing Information Protocol
               NCP               NetWare Core Protocol
Applications developed with the SCO OpenServer Development System use TLI to communicate over IPX/SPX.

SAPD

The SAPD library implements an API to query and register services with the Service Access Protocol daemon (SAPD) found on NetWare networks. 

Table 1-8 SAPD library routines (SAPD)

              -------------------------------------------------
              Routine            Description
              -------------------------------------------------
              ispx_advertise     advertise and unadvertises a
                                 network service provider
              ispx_get_address   determine the network number
                                 of a given named server
              ispx_nsrvr_rqst    perform a local query of a
                                 NetWare subnet for advertised
                                 network services
Applications developed with the SCO OpenServer Development System use the routines in Table 1-8, ``SAPD library routines (SAPD)'' to communicate with the Service Access Protocol daemon.

NetBIOS

NetBIOS is a session-level interface that uses alphanumeric strings rather than numbers to identify processes on the network. The current NetBIOS is derived from the NetBIOS introduced by IBM on its first PC LAN network adapter cards. Applications developed with the SCO OpenServer Development System use XTI to communicate over NetBIOS transports.

SMUX

SMUX is a protocol that defines how certain daemons (SMUX peers) provide information about and carry out control requests on devices on a network. The SMUX peers communicate with a process called an SNMP agent (Simple Network Management Protocol agent). This agent acts as the central processing point on a single host for queries and commands sent from a network management station. Network administrators use these network management stations to monitor the status of devices anywhere on the network, and to issue commands that affect the operation or status of those devices. 

Table 1-9 SMUX library routines (SLIB)

             ----------------------------------------------------
             Routine               Description
             ----------------------------------------------------
             snmpio_api            network I/O and timestamp
                                   routines for SNMP management
                                   applications
             snmp_pdu              operations on SMUX PDUs
             snmp_authentication   SNMP authentication operations
             smux_util             SMUX library routines
SMUX peers developed with the SCO OpenServer Development System use the library routines listed in Table 1-9, ``SMUX library routines (SLIB)'' to communicate with an SNMP agent.