?
Solved

rpc connection

Posted on 1997-05-16
2
Medium Priority
?
455 Views
Last Modified: 2013-12-26
Hello I´d like to know how to establish contact between an rpc-server and an rpc-client using rpcgen and its functions.
0
Comment
Question by:butsch
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Expert Comment

by:waslap
ID: 1292873
Give me a 100 points and I'll give you a nice example using threads and rpc.
0
 

Accepted Solution

by:
albertp earned 100 total points
ID: 1292874
It's not so easy... First you have to put your client code in a file named, ex. client.c, and your server, with the remote procedures, in other file like server.c. Then, you have to create a file named main.x with a description of your RPC for the rpcgen. Then you can create the 'stub' code with rpcgen:

rpcgen main.x

That will create: main_clnt.c (for the client side)
main_xdr.c (for the conversions to XDR format)
main_svc.c (for the server side)
main.h (with the definitions of common structures).

Now, you have to create a interface module between your client code (client.c) and the main_clnt.c generated. for ex. name it client_cif.c. The same for the server, and name it server_sif.c.

Don't panic, now you only have to compile all:

client:
     gcc -o client main_clnt.o main_cif.o client.o main_xdr.o -lrpclib
     chmod 755 client

For the server, do the same.

Well, the sintax for main.x and the _sif and _cif are large to explain, but they are easy. It's better you read a litte of
'Power programming with RPC', J.Bloomer, 1992
or
'Internetworking with TCP/IP', vol.3, BSD socket version, from D.E. Comer and D.L. Stevens. 1987

This popular books have got a lot of clear examples.

Good luck!!
albertp
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Suggested Courses
Course of the Month14 days, 12 hours left to enroll

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question