Solved

rpc connection

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to know only "File created" with EventLog 3 34
post4 challenge 28 100
mapBully challenge 6 133
Updating statistics with error notification email in SQL server 4 95
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: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

770 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