Solved

rpc connection

Posted on 1997-05-16
2
446 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 50 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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

717 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