rpcgen generates sample code for the client and server sides. Use these options to generate the desired templates.
Table 3-3 rpcgen Template Selection Flags
Flag |
Function |
---|---|
Generate all template files |
|
Generate client-side template |
|
Generate server-side template |
|
Generate makefile template |
The files can be used as guides or by filling in the missing parts. These files are in addition to the stubs generated.
A C-style mode server template is generated from the add.x source by the command:
rpcgen -N -Ss -o add_server_template.c add.x
The result is stored in the file add_server_template.c. A C-style mode, client template for the same add.x source is generated with the command line:
rpcgen -N -Sc -o add_client_template.c add.x
The result is stored in the file add_client_template.c. A make file template for the same add.x source is generated with the command line:
rpcgen -N -Sm -o mkfile_template add.x
The result is stored in the file mkfile_template. It can be used to compile the client and the server. If the -a flag is used as follows:
rpcgen -N -a add.x
rpcgen generates all three template files. The client template goes into add_client.c, the server template to add_server.c, and the makefile template to makefile.a. If any of these files already exists, rpcgen displays an error message and exits.
When you generate template files, give them new names to avoid the files being overwritten the next time rpcgen is executed.