Solved

RPC and clnt_create() vs clnttcp_create()

Posted on 1997-01-14
1
712 Views
Last Modified: 2013-12-26
I am trying to learn RPC. I would like to use clnttcp_create() instead of clnt_create() in my client application. How do I do this ? The server portion has svctcp_create(RPC_ANYSOCK, 10240, 10240). So I would then need to do

clnttcp_create(addr, PROGNUM, VERSNUM, sockp, 10240, 10240),
but where does addr, and sockp come in ? does RPC fill them in, or have I to make the connection, and then call clnttcp_create() ?
0
Comment
Question by:perera
1 Comment
 
LVL 1

Accepted Solution

by:
mart010897 earned 100 total points
ID: 1292228
Hi,

I'm pretty sure that:

struct sockaddr_in *addr

needs to be set by you to be the location of the service your client wants to connect to.  Furthermore, the addr struct should contain the port number of the service you are trying to connect to, or 0 if you can look it up using the remote port mapper service.

int *sockp

gets updated by the call, it's a pointer to the socket you are using for this.  But I don't know if it needs to be a socket before the call.  I would think probably yeah it does, cos otherwise i don't see how the function would have anything to work with.

The last two arguments to both calls are supposed to be buffer sizes, set to 0 to use defaults.

I would think that in your client you would use gethostbyname() socket() bind() blah blah blah to create the sockaddr_in *addr and int *sockp and then do your clnttcp_create().

A lot of times when you're dealing with Sun material the only way to find out what to do is to look at someone else has done it, preferably someone who doesn't work for Sun :)  Get a look at the source code for another RPC client/server pair if you get stuck...

But I'm fairly sure that the info i gave above is correct; I did it once upon a time, and I got it working... beyond that it all gets fuzzy... :)

Good luck, and feel free to mail me directly...

Mart
mart@voicenet.com
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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 video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

759 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

24 Experts available now in Live!

Get 1:1 Help Now