1836644 Members
1575 Online
110102 Solutions
New Discussion

RPC help.

 
SOLVED
Go to solution
M.R.Anand
Occasional Advisor

RPC help.

Friends,

I have created a sample RPC program to use a particular PORT instead of using the dynamic port. I have attached the sample files with this message.

I have done the following to bind to the specific port but if i check the daemon it is telling me that the RPC is not registered and sometimes misc. tli flags error. but in the code it is not giving any error or failiure status.

FYI. i have done the following steps in sample code.

1. created the tcp port with ANYSOCK value.
2. Creating the new socket.
3. Set the sockopt value
4. bind the port and address details with new socket.
5. created the RPC using svc_create. and run it using svc_run().

please let me know

1. how to confirm the PRC port usage? any command?
2. What would be the changes to be done on client RPC side??
10 REPLIES 10
M.R.Anand
Occasional Advisor

Re: RPC help.

It will be very helpful for me if you friends give me the reply in detail.

Thank you very much in advance for your help.

-Anand.
U.SivaKumar_2
Honored Contributor
Solution

Re: RPC help.

Hi,

First you have to select a unique TCP port number which is not listed in /etc/services file.

Then add your service name , port number and tcp as per sytax in the file /etc/services.

If you want to use any program number for your RPC service add it in /etc/rpc file.

After the above changes
#inetd -c

To see whether RPC service is running use this command
#rpcinfo

more details
#man rpcinfo

regards,
U.SivaKumar
Innovations are made when conventions are broken
M.R.Anand
Occasional Advisor

Re: RPC help.

Dear siva,

Im the application support and i dont have the access to system files ie etc/ directory. But i check with support and they updated me that update for the said files not required. Please confirm if i use Specific port should i configure the service and rpc files?? is it a must? is that the reason??

Thanks,
Anand.
U.SivaKumar_2
Honored Contributor

Re: RPC help.

Dear anand ,
IF you want to run your service in inetd mode example :- telnetd daemon ( look at /etc/inetd.conf ) you will have to do the things I have mentioned.

But If you want to just run the program in daemon mode for your service to listen then avoid my steps. Since you using higher port number > 1023 for binding , you will not need
any root permission to bind to your specified port.

regards,
U.SivaKumar
Innovations are made when conventions are broken
M.R.Anand
Occasional Advisor

Re: RPC help.

shiva,
i added the port number and version number in etc/services and etc/rpc files. if i run the daemon its running fine and if i check the rpc using the following command it gives the below error.

$>rpcinfo -t IPaddress 824395014
rpcinfo: RPC: Unable to receive; event requires attention
program 824395014 version 6 is not available
[1] + Bus error(coredump) run.exe &

any advise ???

Thanks
-Anand.
U.SivaKumar_2
Honored Contributor

Re: RPC help.

Hi,
try removing that line from /etc/rpc and runing your program as standalone daemon.
#./myrpcservice

run rpcinfo does the error show up ?

regards,
U.Sivakumar
Innovations are made when conventions are broken
M.R.Anand
Occasional Advisor

Re: RPC help.

yes..still the same error im getting. If possible can you check the same piece of code in your system?? i think this concept includes only two files. I have attached the two files with this reply.

run.c file includes the following

#include
#include

extern SVCXPRT *svc_port_create();
int test_only(struct svc_req *, SVCXPRT *);

int main()
{
SVCXPRT *SvcPtr = NULL;
struct svc_req *InPtr1;
SVCXPRT *InPtr2;

SvcPtr = svc_port_create(50005, test_only(InPtr1, InPtr2), 824395014, 6, "tcp");
svc_run();
return 0;
}

int test_only(struct svc_req *ptr1, SVCXPRT *ptr2)
{
/* do nothing */
return 0;
}

HUGGG!!! its really hard time for me to fix this...

Thanks
Anand
U.SivaKumar_2
Honored Contributor

Re: RPC help.

Restart rpcd daemon with help of root after you make chages to /etc/rpc

regards,
U.SivaKumar
Innovations are made when conventions are broken
M.R.Anand
Occasional Advisor

Re: RPC help.

Done. now the error message is "connection refused" if i try to start the port daemon.

thanks
-Anand.
U.SivaKumar_2
Honored Contributor

Re: RPC help.

Hi,

Forgot to say , restart rpcbind daemon ( HP-UX 11.X ) or portmap daemon ( HP-UX 10.X ) after changing /etc/rpc configuration.

After editing /etc/service restart inetd daemon
by
#inetd -c

regards,
U.SivaKumar
Innovations are made when conventions are broken