svc_tli_create()--Create a Server Handle


  Syntax

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

 SVCXPRT svc_tli_create(const int fildes,
                         const struct netconfig
                             *netconf,
                         const struct t_bind
                             *bindaddr,
                         const u_int sendsz,
                         const u_int recvsz);

  Service Program Name: QZNFTRPC

  Default Public Authority: *USE

  Threadsafe: No

The svc_tli_create() function creates an RPC server handle.


Parameters

fildes  (Input) 
The file descriptor on which the service is listening. The only permitted value for a user application is RPC_ANYFD. If the file descriptor fildes is RPC_ANYFD, it opens a file descriptor on the transport specified by netconf.

netconf  (Input) 
The transport protocol.

bindaddr  (Input) 
The address where fildes is bound if it is unbound.

sendsz  (Input) 
The size of the send buffer. When a value of zero is specified, a suitable default value will be chosen by the system.

recvsz  (Input) 
The size of the receive buffer. When a value of zero is specified, a suitable default value will be chosen by the system.

Authorities

No authorization is required.


Return Value

xprt Upon successful completion, this function returns a pointer to the created RPC server handle.
NULL svc_tli_create() was not successful. The errno variable is set to indicate the reason.


Error Conditions

[ENOMEM] Out of memory.
[EUNKNOWN] Unknown system state.
[EADDRNOTAVAIL] Address not available. This value is set when bindaddr is rejected by the transport layer.
[EIO] Input/output error. This value is set as a result of network transport failure. It indicates that RPC cannot handle an error that occurred in lower transport levels.
[EACCES] Permission denied.
[EBADF] Bad file descriptor. This value is set when the fildes parameter is not valid or cannot be used as a transport endpoint.
[EFAULT] The address used for a bindaddr was not available.
[ENOBUFS] There is not enough buffer space available for the API.
[EINVAL] An invalid value was supplied for the input parameter nconf.
[EADDRINUSE] Local address is in use. This value is set when fildes cannot be bound to any local address.


Error Messages

Message ID Error Message Text
CPIA1B2 I TI-RPC encountered a problem in the transport protocol.
CPIA1B3 I TI-RPC encountered a problem in the server.
CPF3CF2 E Error(s) occurred during running of &1 API.
CPF9872 E Program or service program &1 in library &2 ended. Reason code &3.


Related Information


Example

The following example shows how svc_tli_create is used.

Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.

/* Define remote program number and version */
#define RMTPROGNUM (u_long)0x3fffffffL
#define RMTPROGVER (u_long)0x1

#include <stdio.h>
#include <rpc/rpc.h>
#include <netconfig.h>

main()
{
  SVCXPRT *svc;
  struct netconfig *nconf;
  int fd;

  ...
  /* Returns a pointer to nconf corresponding to UDP */
  if ((nconf = getnetconfigent("UDP")) ==
               (struct netconfig *)NULL) {
    fprintf(stderr, "Cannot get netconfig entry for UDP\n");
    exit(1);
  }

  ...

  svc = svc_tli_create(RPC_ANYFD,nconf,
                                  (struct t_bind *)NULL,
                                  0, 0);
  if (svc == (SVCXPRT *)NULL){
    fprintf(stderr, "svc_tli_create failed!!\n");
    exit(1);
  }

  ...

}


API introduced: V4R2

[ Back to top | Remote Procedure Call (RPC) APIs | APIs by category ]