When a procedure has been called through broadcast RPC and cannot provide a useful response, the server should send no reply 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 detects this and sends no reply.
Example 3-23is a procedure that replies only if it is an NFS server.
void * reply_if_nfsserver() { char notnull; /*only here so we can *use its address */ if( access( "/etc/dfs/sharetab", F_OK ) < 0 ) { /* prevent RPC from replying */ return( (void *) NULL ); } /* assign notnull a non-null value * so RPC will send a reply */ return( (void *) ¬null ); }
A procedure must return a non-NULL pointer when it wants RPC library routines to send a reply.
In Example 3-23, if the procedure reply_if_nfsserver() is defined to return non void values, the return value (¬null) should point to a static variable.