[comp.unix.wizards] Need help with batched RPC calls

trebor@lkbreth.foretune.co.jp (Robert J Woodhead) (05/21/91)

I am just getting started playing around with RPC.  Eventually I will
be writing a very complicated server, so I decided it would be prudent
to write a simple one first to get aquainted.

So far the learning process has been fairly painless, but now I've run
into a snag, and thus I come, reverently, to the unix experts of the
net with a (hopefully simple) question.

What I want to do is as follows:  Have a server that has many clients
at any one time.  When it gets a message (via RPC call) from a client,
it sends it on to all the other clients.  In other words, it's a
multi-user chat program ( ;^) ).

All of the clients are sitting at a select() call waiting for a
RPC callback from the server or keyboard input.  This works fine.

Now, version 1 of this program just used normal RPC calls.  The
client would RPC a message to the server, which would RPC it to the
other clients.

Of course, there is a built in snag to this.  If client A RPCs a
message, then client B RPC's a message, you can get a deadlock
where the server and client B are both waiting for the other to
respond.

Knowing this, I decided to try using batched RPC calls.  Unfortunately,
this doesn't work because you need to do a final "normal" RPC call
to _each client that got batched calls_, not _any client (such as
the one who sent the original message)_, to dump the batched calls
to the clients -- and you still get a possible deadlock.

All I want to be able to do is pass a message to the other clients
WITHOUT the server needing to get any acknowledgement.  I know that
I could do it by buffering up messages and having the clients
send a periodic "got anything for me" message to the server, but
this is inelegant.

I tried messing with TCP_NODELAY but that doesn't do anything.
Any suggestions?

Please email to me if possible; I will summarize and post to the net
later.  Many thanks in advance.



-- 
+--------------------------------------------------------------------------+
| Robert J. Woodhead, Biar Games / AnimEigo, Incs.   trebor@foretune.co.jp |
| "The Force. It surrounds us; It enfolds us; It gets us dates on Saturday |
| Nights." -- Obi Wan Kenobi, Famous Jedi Knight and Party Animal.         |