Solved

RPC and clnt_create() vs clnttcp_create()

Posted on 1997-01-14
1
785 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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
Separate into files by filename 12 92
windows 10 how make picture as desktop background 2 73
if loop in java 3 174
wordmultiple challenge 12 170
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…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

751 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