我正在尝试运行一个使用rpcgen创建的简单RPC程序.这是一个简单的因子计划.这是我的第一个RPC程序.make工作正常.还创建了可执行文件.但是在尝试运行可执行文件时,我收到此错误:
$sudo ./fact_server
Cannot register service: RPC: Unable to receive; errno = Connection refused
unable to register (FACTPROGRAM, FACTVERSION, udp).
Run Code Online (Sandbox Code Playgroud)
我尝试在具有相同操作系统(ubuntu)的另一台PC上运行相同的程序.它在那里运行完美.
检查服务是否正在运行rpcinfo.这就是我得到的.
$ rpcinfo
program version netid address service owner
100000 4 tcp6 ::.0.111 portmapper superuser
100000 3 tcp6 ::.0.111 portmapper superuser
100000 4 udp6 ::.0.111 portmapper superuser
100000 3 udp6 ::.0.111 portmapper superuser
100000 4 tcp 0.0.0.0.0.111 portmapper superuser
100000 3 tcp 0.0.0.0.0.111 portmapper superuser
100000 2 tcp 0.0.0.0.0.111 portmapper superuser
100000 4 udp 0.0.0.0.0.111 portmapper superuser
100000 3 udp 0.0.0.0.0.111 portmapper superuser
100000 2 udp 0.0.0.0.0.111 portmapper superuser
100000 4 local /run/rpcbind.sock portmapper superuser
100000 3 local /run/rpcbind.sock portmapper superuser
24 5 udp 0.0.0.0.3.99 - superuser
24 5 tcp 0.0.0.0.3.100 - superuser
Run Code Online (Sandbox Code Playgroud)
如果服务未运行,则必须启动它rpcbind.在Ubuntu上,我需要root权限才能运行该服务.
最近 Linux 版本的 rpcbind有一个错误/功能- 它现在在系统启动后不活动/运行,但应该根据 /usr/lib/systemd/system/ 中的 systemctl 配置 rpcbind.service 文件以某种方式“套接字激活” :
[Install]
Also=rpcbind.socket
Run Code Online (Sandbox Code Playgroud)
检查此线程是否存在导致 Ubuntu 问题的相同错误/功能(https://bugs.launchpad.net/ubuntu/+source/rpcbind/+bug/1558196)。
对您(我们)的 rpcbind 问题的简短回答是- 为了运行 RPC 服务器代码,请对系统的systemctrl 配置进行此修改:
sudo systemctl add-wants multi-user.target rpcbind
Run Code Online (Sandbox Code Playgroud)
现在,设置 rpcbind 运行的预期方法是以某种方式访问 /var/run/rpcbind.sock,我非常感谢一些 Unix/Linux 大师,他们可能会启发我 RPC 服务器应用程序代码应该做什么才能实现这个 rpcbind “套接字激活”效果。
| 归档时间: |
|
| 查看次数: |
23757 次 |
| 最近记录: |