Solved

rpc connection

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Host to IP 7 77
Separate into files by filename 12 76
Define unique primary key 9 89
Bartender label printing - switch on and off graphics 3 17
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…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

864 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

19 Experts available now in Live!

Get 1:1 Help Now