Monday, February 1, 2016

RPC command

usage: rpcgen infile

        rpcgen [-abkCLNTM][-Dname[=value]] [-i size] [-I [-K seconds]] [-Y path] infile

        rpcgen [-c | -h | -l | -m | -t | -Sc | -Ss | -Sm] [-o outfile] [infile]

        rpcgen [-s nettype]* [-o outfile] [infile]

        rpcgen [-n netid]* [-o outfile] [infile]

options:

-a
Generate all files, including samples
-b             
Backward compatibility mode (generates code for SunOS 4.1)
-c             
Generate XDR routines
-C             
ANSI C mode
-Dname[=value] 
Define a symbol (same as #define)
-h             
Generate header file
-i size       
Size at which to start generating inline code
-I             
Generate code for inetd support in server (for SunOS 4.1)
-K seconds     
Server exits after K seconds of inactivity
-l             
Generate client side stubs
-L            
Server errors will be printed to syslog
-m           
Generate server side stubs
-M           
Generate MT-safe code
-n netid       
Generate server code that supports named netid
-N                
Supports multiple arguments and call-by-value
-o outfile     
Name of the output file
-s nettype    
Generate server code that supports named nettype

For our practical we will use command:

[root@server-host ~] rpcgen –a filename.x


Start RPC Server:

Start service now

[root@server-host ~] service rpcbind start 

Or

Start service automatically

[root@server-host ~] insserv rpcbind


Compile Client:

[root@server-host ~] gcc –o client_object_file client.cserver.c


Compile Server:

[root@server-host ~] gcc –o server_object_file server.c


Run Server:

[root@server-host ~]./server_object_file


Run Client:

[root@server-host ~]./client_object_file server_host
If server_host is in same machine than server_host = localhost

No comments:

Post a Comment