Purpose
Creates a User Datagram Protocol/Internet Protocol (UDP/IP) service transport handle.
Library
C Library (libc.a)
Syntax
#include <rpc/rpc.h>SVCXPRT *svcudp_create ( sock)
int sock;
Description
The svcudp_create subroutine creates a Remote Procedure Call (RPC) service transport handle based on UDP/IP and returns a pointer to it.
The UDP/IP service transport handle is used only for procedures that take up to 8KB of encoded arguments or results.
Parameters
| Item | Description | 
|---|---|
| sock | Specifies the socket associated with the service transport handle. If the value specified by the sock parameter is RPC_ANYSOCK, the svcudp_create subroutine creates a new socket and sets the service transport handle socket number to xprt->xp_sock. If the socket is not bound to a local UDP/IP port, then the svcudp_create subroutine binds the socket to an arbitrary port. The port number is set to xprt->xp_port. | 
Restrictions
In AIX® 5.2, the maximum number of open file descriptors that an RPC server can use has been set to 32767 so that compatibility can be maintained with RPC-server applications built on earlier releases of AIX.
Return Values
Upon successful completion, this subroutine returns a valid RPC service transport. If unsuccessful, it returns a value of null.
Purpose
Creates a User Datagram Protocol/Internet Protocol (UDP/IP) service transport handle.
Library
Network Services Library (libnsl.a)
Syntax
#include <rpc/rpc.h>SVCXPRT *svcudp_create (fd)
int fd;Description
The svcudp_create subroutine creates a remote procedure call (RPC) service transport handle. The fd parameter specifies a file descriptor on the UDP transport. You can set the value of the fd parameter to RPC_ANYSOCK, so that the svcudp_create subroutine creates a new file descriptor on UDP transport and binds the file descriptor to a port.
The UDP/IP service transport handle is used only for procedures that take up to 8KB of encoded arguments or results.
Use the svc_create subroutine instead of the svcudp_create subroutine. The svcudp_create subroutine is compatible only with earlier versions of AIX.
Parameters
| Item | Description | 
|---|---|
| fd | Specifies the file descriptor associated with the udp transport. | 
Return Values
| Item | Description | 
|---|---|
| a valid RPC service transport handle | successful | 
| a null value | unsuccessful | 
Examples
#include <rpc/rpc.h>
static void dispatch(struct svc_req *, SVCXPRT *);
int main()
{
  SVCXPRT *svc=NULL;
  int fd;
  int protocol = IPPROTO_UDP;
  /* Set the file descriptor to RPC_ANYFD */
  fd = RPC_ANYSOCK;
  svc = (SVCXPRT *) svcudp_create(fd);
  if(svc==NULL)
  {
    fprintf(stderr,"svcudp_create() failed");
    exit(1);
  }
  /* create association between program & version number and dispatch routine */
  if(svc_register(svc, prognum, versnum, dispatch, protocol) == 0)
  {
    fprintf(stderr,"svc_register() failed");
    exit(1);
  }
  
  /* Accept client requests */
  svc_run();
  return 1;
}
static void dispatch(rqstp, transp)    /* remote procedure */
  struct svc_req *rqstp;
  SVCXPRT        *transp;
{
  /* Dispatch Routine Code */
}