DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Programming with Remote Procedure Calls (RPC)

Server response to broadcast calls

When a procedure is known to have been called via broadcast RPC, and the called procedure determines that it cannot provide the client with a useful response, it is usually best for the server to send no reply back to the client. This reduces network traffic.

To prevent the server from replying, a remote procedure can return NULL as its result. The server code generated by rpcgen will detect this and not send out a reply.

This is an example of a procedure that replies only if it thinks it is an NFS server:

   void *
   reply_if_nfsserver_1()
   {
   	char notnull;	/* just here so we can use its address */
   

if (access("/etc/exports", F_OK) < 0) { return (NULL); /* prevent RPC from replying */ } /* * assign notnull a non-null value so RPC will send out a reply */ return ((void *)&notnull); }


NOTE: If a procedure returns type void *, it must return a non-NULL pointer if it wants RPC to send a reply.


© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004