Solved

rpc connection

Posted on 1997-05-16
2
376 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
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
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…
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.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

758 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now