0

I have just started learning about RPC and the rpcgen compiler. I am using the FreeBSD OS and trying to implement a simple program that prints "Hello World" to the console using RPC. I first created the '.x' file and using rpcgen, obtained the client and server stubs. Also, I am using both server and client code on the same machine for now. The whole code compiles fine but when I run the program like this: "./firsttry localhost", it outputs the following error: "RPC: Program not registered". What am I doing wrong here? Could it be a problem with the code or is my implementation incorrect?

4

1 回答 1

2
  1. 首先,检查是否安装了“rpcbind”,如果没有先安装:
    ~$ sudo apt-get install rpcbind 
  2. Then run your server code with superuser permissions as
     ~$ sudo ./firsttry localhost 
  3. There won't be any error now.

Note : instead of writing server and client code by yourself, use the strength of rpcgen . While compiling your .x file, try

 ~$ rpcgen -a filename.x 
它将自动生成所有文件。只需进行少量更改(在服务器和客户端代码中)。试试看,省时省力。

于 2012-05-18T01:59:14.847 回答