Solved

RPC and clnt_create() vs clnttcp_create()

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Login Script to Copy Folders 12 35
format the code in java 6 93
conditional code and condition difference 9 82
mapAB Challlenge 35 143
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: 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.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

786 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