Solved

RPC and clnt_create() vs clnttcp_create()

Posted on 1997-01-14
1
763 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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 80
windows 10 how make picture as desktop background 2 65
Execute multiple curl cmds with sleep and send output to file 10 104
Thin secure Windows 10 5 102
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
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 …
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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

821 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