LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-05-2002, 04:16 AM   #1
obashir
LQ Newbie
 
Registered: Nov 2002
Location: Loughborough, UK
Distribution: Redhat 9, Fedora, Yellow Dog
Posts: 29

Rep: Reputation: 15
RPC Programming in Linux


Hello

I am trying to learn RPC programming in Linux. I wrote the following .x file

struct Params
{
float a;
float b;
float c;
};

struct Result
{
float x1;
float x2;
};

program QUADRATIC_PROGRAM
{
version QUADRATIC_VERSION
{
Result QUADRATIC_PROCEDURE(Params) = 1;
} = 1;
} = 0x33000000;

and the following client program

#include <rpc/rpc.h>
#include <stdio.h>
#include <stdlib.h>
#include "quad.h"

int main(int argc,char** argv)
{
CLIENT* ClientHandle;
Result* OneResult;
Params OneEquation;
if (argc != 6)
puts("USAGE: client <server_host> <a> <b> <c> <protocol>");
else
{
OneEquation.a = atof(argv[2]);
OneEquation.b = atof(argv[3]);
OneEquation.c = atof(argv[4]);
printf("Processing for parameters %f:%f:%f\n",
OneEquation.a,OneEquation.b,OneEquation.c);
ClientHandle = clnt_create(argv[1],QUADRATIC_PROGRAM,
QUADRATIC_VERSION,argv[5]);
if (ClientHandle == NULL)
{
printf("Error acquiring client handle\n");
exit (0);
}
printf("Client Handle acquired for %s over %s\n",argv[1],
argv[5]);
if ((OneResult =
quadratic_procedure_1(&OneEquation,ClientHandle))
!= NULL)
{
printf("Roots are %f : %f\n",OneResult.x1,OeResult.x2);
}
else
printf("Error: %s\n",clnt_sperror(ClientHandle,argv[1]));
}
return(0);
}


I compiled the program using the following commands

g++ -c client.c
g++ -c quad_clnt.c
g++ -c quad_xdr.c
g++ client.o quad_clnt.o quad_xdr.o -o client -lnsl

NOW when I execute the program using the following command,

./client 127.0.0.1 1 0 -4 tcp

I cannot get a handle to the client

Can some one help

Thank you

OMAR.
 
Old 12-05-2002, 10:23 AM   #2
Malicious
Member
 
Registered: Jan 2002
Location: Galveston Island
Distribution: suse, redhat
Posts: 208

Rep: Reputation: 30
Where is the server?
 
Old 12-08-2002, 11:52 PM   #3
obashir
LQ Newbie
 
Registered: Nov 2002
Location: Loughborough, UK
Distribution: Redhat 9, Fedora, Yellow Dog
Posts: 29

Original Poster
Rep: Reputation: 15
Thanks Malicious

I works with the server up and running

Best Wishes & Regards

OMAR.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
NFS RPC: Port mapper failure - RPC: Unable to receive KEJP Linux - Networking 6 12-18-2006 03:14 AM
rpc.lockd & rpc.statd twantrd Linux - General 1 05-21-2005 10:24 AM
Unmounting NFS filesystems: Cannot MOUNTPROG RPC: RPC ErnstVikenstein Linux - General 4 05-31-2003 01:10 AM
RPC programming problem kopernic Programming 5 03-17-2003 07:02 AM
RPC Programming in Linux obashir Linux - Networking 1 12-06-2002 11:33 AM


All times are GMT -5. The time now is 10:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration