Unix Programming - RPC question

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > September 2005 > RPC question





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author RPC question
clearthink@cavtel.net

2005-09-29, 6:00 pm

I have an existing multi-threaded program.

I want to add RPC. The program needs to act
as a client calling remote methods and act
as a server accepting remote calls. Having
the program act as a client is straightforward.

I am confused on it acting as a server which
plays nice with the rest of the code.

I see the code in XXXX_svr.c as generated by rpcgen.

(on my linux box, it consists of calls
to create and register a UDP and
TCP service finally calling srv_run()
which is the main receive-dispatch
loop)

But ...

The last line of the main method in my program
(by which some other 13 threads have been created
and are running) calls an infinite input-process-print
loop. It's supports a legacy way to
get diagnostics through the keyboard.

So how can I insert the call to src_run()? For if
I do, it will not return and the keyboard I/O loop
above is disabled. And the otherway around the
keyboard loop will not return so srv_run() does
not start.

Q1.

Must I put that code into main? Or
can I spin off a new thread and put
that code in there? If I locate the
srv_run() in a thread, how do I get
the thread to wake up when I/O comes
and how to I stop it from pinging
the CPU?


How do people do this?

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com