Dienstag, 8. März 2011

CS6223 RPC registerrpc()

Hong Kong 1995 wonders never cease
http://www.youtube.com/watch?v=GnhpeDWZJow

Remote Procedure Calls (RPC)-- registerrpc()
http://www.cs.cf.ac.uk/Dave/C/node33.html

The Server Side

We can use the original read_dir.c file. All we need to do is register the procedure and start the server.

The procedure is registered with registerrpc() function. This is prototypes by:

registerrpc ( u_long prognum /* Server program number */,
u_long versnum /* Server version number */,
u_long procnum /* server procedure number */,
char *procname /* Name of remote function */,
xdrproc_t inproc /* Filter to encode arg */,
xdrproc_t outproc /* Filter to decode result */ );

The parameters a similarly defined as in the rpc_reg simplified interface function.

We have already discussed the setting of the parametere with the protocol rls.h header files and the rls_xrd.c XDR filter file.

The svc_run() routine has also been discussed previously.

The full rls_svc.c code is as follows:

#include
#include "rls.h"

main()
{
extern bool_t xdr_dir();
extern char * read_dir();

registerrpc ( DIRPROG, DIRVERS, READDIR,
read_dir, xdr_dir, xdr_dir );

svc_run();

}


1 Kommentar:

Anonym hat gesagt…

List of RPC Programming References

http://www.chm.tu-dresden.de/edv/manuals/aix/aixprggd/progcomc/rpc_ref.htm#OjD3230sall