Writing RPC Server code

Glen Eustace G.Eustace at massey.ac.nz
Mon Nov 19 08:55:09 AEST 1990


I am just starting to write some programs that use RPCs but have hit
a problem.  I admit to being a complete novice in this area.  I have
RTFMs but still am not sure where I am going wrong.  It could well be
that I simple don't understand what I am reading.  I would be very
appreciative of someone pointing me at the error in my ways or
sending a fragment of code that achieves the correct result.

All the examples of RPC servers that I have seen seem to rely on the
client calls being able to be executed rapidly.  Hence all client
calls can and are serviced by a single daemon e.g. mountd, quotad etc
etc.

What I was hoping to do was the following;

Client side.
============

clntudp_create();
...
clnt_call();   /* rpc procedure 1 */
...
clnt_call();   /* rpc procedure 2 */
...
clnt_call();   /* rpc procedure 3 */
...
clnt_destroy();

some of the rpc procedures may take a non-trivial length of time.

What I thought was the correct thing to do, on the server side, was
to create a new instance of the daemon when the clntudp_create is
executed and let that client/server pair talk to each other until the
clnt_destroy at which time the server terminates.  My thinking was
that additional client/server pairs would be created as needed.

I can't seem to work out how one can actually do the above.  By
implication I am wondering if this is the correct way to do things.
If it is, how does one handle the new client/server pairs in the
server code?  If it is not the correct way to do things how does one
prevent a new client from having to wait for an earlier one to
complete its processing?  My line of thought was based on the TCP
idea i.e. telnet, where a connection is made on a well known port and
then the server and client shift their conversation to another thus
making the well known port available for a new connection.

-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Glen Eustace, Software Manager, Computer Centre, Massey University,
Palmerston North, New Zealand.        EMail: G.Eustace at massey.ac.nz
Phone: +64 63 69099 x7440, Fax: +64 63 505 607,    Timezone: GMT-12



More information about the Comp.unix.questions mailing list