# phpman > man > rpc_svc_create(3t)

[RPC_SVC_CREATE(3)](https://www.chedong.com/phpMan.php/man/RPCSVCCREATE/3/markdown)        BSD Library Functions Manual        [RPC_SVC_CREATE(3)](https://www.chedong.com/phpMan.php/man/RPCSVCCREATE/3/markdown)

## NAME
     **rpc**___**svc**___**create**, **svc**___**control**, **svc**___**create**, **svc**___**destroy**, **svc**___**dg**___**create**, **svc**___**fd**___**create**,
     **svc**___**raw**___**create**, **svc**___**tli**___**create**, **svc**___**tp**___**create**, **svc**___**vc**___**create** — library routines for the cre‐
     ation of server handles

## SYNOPSIS
### #include <rpc/rpc.h>

     _bool_t_
     **svc**___**control**(_SVCXPRT_ _*svc_, _const_ _u_int_ _req_, _void_ _*info_);

     _int_
     **svc**___**create**(_void_ _(*dispatch)(struct_ _svc_req_ _*,_ _SVCXPRT_ _*)_, _const_ _rpcprog_t_ _prognum_,
         _const_ _rpcvers_t_ _versnum_, _const_ _char_ _*nettype_);

     _SVCXPRT_ _*_
     **svc**___**dg**___**create**(_const_ _int_ _fildes_, _const_ _u_int_ _sendsz_, _const_ _u_int_ _recvsz_);

     _void_
     **svc**___**destroy**(_SVCXPRT_ _*xprt_);

     _SVCXPRT_ _*_
     **svc**___**fd**___**create**(_const_ _int_ _fildes_, _const_ _u_int_ _sendsz_, _const_ _u_int_ _recvsz_);

     _SVCXPRT_ _*_
     **svc**___**raw**___**create**(_void_);

     _SVCXPRT_ _*_
     **svc**___**tli**___**create**(_const_ _int_ _fildes_, _const_ _struct_ _netconfig_ _*netconf_,
         _const_ _struct_ _t_bind_ _*bindaddr_, _const_ _u_int_ _sendsz_, _const_ _u_int_ _recvsz_);

     _SVCXPRT_ _*_
     **svc**___**tp**___**create**(_void_ _(*dispatch)(struct_ _svc_req_ _*,_ _SVCXPRT_ _*)_, _const_ _rpcprog_t_ _prognum_,
         _const_ _rpcvers_t_ _versnum_, _const_ _struct_ _netconfig_ _*netconf_);

     _SVCXPRT_ _*_
     **svc**___**vc**___**create**(_const_ _int_ _fildes_, _const_ _u_int_ _sendsz_, _const_ _u_int_ _recvsz_);

## DESCRIPTION
     These routines are part of the RPC library which allows C language programs to make procedure
     calls on servers across the network.  These routines deal with the creation of service handles.
     Once the handle is created, the server can be invoked by calling **svc**___**run**().

## Routines
     See [rpc(3)](https://www.chedong.com/phpMan.php/man/rpc/3/markdown) for the definition of the _SVCXPRT_ data structure.

     **svc**___**control**()
            A function to change or retrieve various information about a service object.  The _req_
            argument indicates the type of operation and _info_ is a pointer to the information.  The
            supported values of _req_, their argument types, and what they do are:

            SVCGET_VERSQUIET
                        If a request is received for a program number served by this server but the
                        version number is outside the range registered with the server, an
                        RPC_PROGVERSMISMATCH error will normally be returned.  The _info_ argument
                        should be a pointer to an integer.  Upon successful completion of the
                        SVCGET_VERSQUIET request, _*info_ contains an integer which describes the
                        server's current behavior: 0 indicates normal server behavior (that is, an
                        RPC_PROGVERSMISMATCH error will be returned); 1 indicates that the out of
                        range request will be silently ignored.

            SVCSET_VERSQUIET
                        If a request is received for a program number served by this server but the
                        version number is outside the range registered with the server, an
                        RPC_PROGVERSMISMATCH error will normally be returned.  It is sometimes de‐
                        sirable to change this behavior.  The _info_ argument should be a pointer to
                        an integer which is either 0 (indicating normal server behavior - an
                        RPC_PROGVERSMISMATCH error will be returned), or 1 (indicating that the out
                        of range request should be silently ignored).

     **svc**___**create**()
            The **svc**___**create**() function creates server handles for all the transports belonging to the
            class _nettype_.  The _nettype_ argument defines a class of transports which can be used for
            a particular application.  The transports are tried in left to right order in NETPATH
            variable or in top to bottom order in the netconfig database.  If _nettype_ is NULL, it
            defaults to "netpath".

            The **svc**___**create**() function registers itself with the rpcbind service (see [rpcbind(8)](https://www.chedong.com/phpMan.php/man/rpcbind/8/markdown)).
            The _dispatch_ function is called when there is a remote procedure call for the given
            _prognum_ and _versnum_; this requires calling **svc**___**run**() (see **svc**___**run**() in [rpc_svc_reg(3)](https://www.chedong.com/phpMan.php/man/rpcsvcreg/3/markdown)).
            If **svc**___**create**() succeeds, it returns the number of server handles it created, otherwise
            it returns 0 and an error message is logged.

     **svc**___**destroy**()
            A function macro that destroys the RPC service handle _xprt_.  Destruction usually in‐
            volves deallocation of private data structures, including _xprt_ itself.  Use of _xprt_ is
            undefined after calling this routine.

     **svc**___**dg**___**create**()
            This routine creates a connectionless RPC service handle, and returns a pointer to it.
            This routine returns NULL if it fails, and an error message is logged.  The _sendsz_ and
            _recvsz_ arguments are arguments used to specify the size of the buffers.  If they are 0,
            suitable defaults are chosen.  The file descriptor _fildes_ should be open and bound.  The
            server is not registered with [rpcbind(8)](https://www.chedong.com/phpMan.php/man/rpcbind/8/markdown).

            Warning: since connectionless-based RPC messages can only hold limited amount of encoded
            data, this transport cannot be used for procedures that take large arguments or return
            huge results.

     **svc**___**fd**___**create**()
            This routine creates a service on top of an open and bound file descriptor, and returns
            the handle to it.  Typically, this descriptor is a connected file descriptor for a con‐
            nection-oriented transport.  The _sendsz_ and _recvsz_ arguments indicate sizes for the send
            and receive buffers.  If they are 0, reasonable defaults are chosen.  This routine re‐
            turns NULL if it fails, and an error message is logged.

     **svc**___**raw**___**create**()
            This routine creates an RPC service handle and returns a pointer to it.  The transport
            is really a buffer within the process's address space, so the corresponding RPC client
            should live in the same address space; (see **clnt**___**raw**___**create**() in [rpc_clnt_create(3)](https://www.chedong.com/phpMan.php/man/rpcclntcreate/3/markdown)).
            This routine allows simulation of RPC and acquisition of RPC overheads (such as round
            trip times), without any kernel and networking interference.  This routine returns NULL
            if it fails, and an error message is logged.

            Note: **svc**___**run**() should not be called when the raw interface is being used.

     **svc**___**tli**___**create**()
            This routine creates an RPC server handle, and returns a pointer to it.  The _fildes_ ar‐
            gument is the file descriptor on which the service is listening.  If _fildes_ is
            RPC_ANYFD, it opens a file descriptor on the transport specified by _netconf_.  If the
            file descriptor is unbound and _bindaddr_ is not NULL, _fildes_ is bound to the address
            specified by _bindaddr_, otherwise _fildes_ is bound to a default address chosen by the
            transport.

            Note: the _t_bind_ structure comes from the TLI/XTI SysV interface, which NetBSD does not
            use.  The structure is defined in <_rpc/types.h_> for compatibility as:

            struct t_bind {
                struct netbuf addr; /* network address, see [rpc(3)](https://www.chedong.com/phpMan.php/man/rpc/3/markdown) */
                unsigned int  qlen; /* queue length (for [listen(2)](https://www.chedong.com/phpMan.php/man/listen/2/markdown)) */
            };

            In the case where the default address is chosen, the number of outstanding connect re‐
            quests is set to 8 for connection-oriented transports.  The user may specify the size of
            the send and receive buffers with the arguments _sendsz_ and _recvsz_; values of 0 choose
            suitable defaults.  This routine returns NULL if it fails, and an error message is
            logged.  The server is not registered with the [rpcbind(8)](https://www.chedong.com/phpMan.php/man/rpcbind/8/markdown) service.

     **svc**___**tp**___**create**()
            The **svc**___**tp**___**create**() function creates a server handle for the network specified by
            _netconf_, and registers itself with the rpcbind service.  The _dispatch_ function is called
            when there is a remote procedure call for the given _prognum_ and _versnum_; this requires
            calling **svc**___**run**().  The **svc**___**tp**___**create**() function returns the service handle if it suc‐
            ceeds, otherwise a NULL is returned and an error message is logged.

     **svc**___**vc**___**create**()
            This routine creates a connection-oriented RPC service and returns a pointer to it.
            This routine returns NULL if it fails, and an error message is logged.  The users may
            specify the size of the send and receive buffers with the arguments _sendsz_ and _recvsz_;
            values of 0 choose suitable defaults.  The file descriptor _fildes_ should be open and
            bound.  The server is not registered with the [rpcbind(8)](https://www.chedong.com/phpMan.php/man/rpcbind/8/markdown) service.

## AVAILABILITY
     These functions are part of libtirpc.

## SEE ALSO
     [rpc(3)](https://www.chedong.com/phpMan.php/man/rpc/3/markdown), [rpc_svc_calls(3)](https://www.chedong.com/phpMan.php/man/rpcsvccalls/3/markdown), [rpc_svc_err(3)](https://www.chedong.com/phpMan.php/man/rpcsvcerr/3/markdown), [rpc_svc_reg(3)](https://www.chedong.com/phpMan.php/man/rpcsvcreg/3/markdown), [rpcbind(8)](https://www.chedong.com/phpMan.php/man/rpcbind/8/markdown)

BSD                               May 3, 1993                              BSD
