Solved

RPC and clnt_create() vs clnttcp_create()

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

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
how to monitor remote shell execution on linux 9 97
Hibernate methods 2 67
lucky13 challenge 11 120
Excel file not created as expected 7 46
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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 is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

932 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

11 Experts available now in Live!

Get 1:1 Help Now