#include <rpc/rpc.h>
SVCXPRT svc_tp_create(const void
(*dispatch)(const svc_req *,
const SVCXPRT *),
const u_long prognum,
const u_long versnum,
const struct netconfig *netconf);
The svc_tp_create() function creates a server handle for the network specified by netconf, and registers itself with the RPC service package (RPCBind).
No authorization is needed.
| xprt | Upon successful completion, this function returns the service handle. |
| NULL | svc_tp_create() was not successful. The errno variable is set to indicate the reason. |
This API calls svc_tli_create() and svc_reg() functions in order to perform its task. It inherits all error conditions from those functions, except setnetconfig() and getnetconfig() errors and RPC_UNKNOWNADDR from svc_reg().
| Message ID | Error Message Text |
|---|---|
| CPIA1B1 I | A problem was encountered in the RPC client. |
| CPIA1B2 I | TI-RPC encountered a problem in the transport protocol. |
| CPIA1B3 I | TI-RPC encountered a problem in the server. |
| CPIA1B8 I | A problem occurred while trying to contact the RPCBind daemon. |
| CPE3418 E | Possible APAR condition or hardware failure. |
| CPF3CF2 E | Error(s) occurred during running of &1 API. |
| CPF9872 E | Program or service program &1 in library &2 ended. Reason code &3. |
See Code disclaimer information for information pertaining to code examples.
The following example shows how svc_tp_create() is used:
/* 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>
static void exm_proc();
/* Dispatcher routine, defined later in program */
main()
{
SVCXPRT *transp;
struct netconfig *nconf;
/* 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);
}
transp = svc_tp_create(exm_proc, RMTPROGNUM, RMTPROGVER,
nconf);
if (transp == (SVCXPRT *)NULL) {
fprintf(stderr, "Cannot create service.\n");
exit(1);
}
...
svc_run();
}
/* The server dispatch function */
static void exm_proc(struct svc_req *rqstp, SVCXPRT *transp)
{
...
}
| Top | Remote Procedure Call (RPC) APIs | APIs by category |