client <-> server interaction in C

Gerard Beekmans gerard at
Tue Nov 22 10:48:30 PST 2005

Jeremy Huntwork wrote:
> Looks good. :) Except, for the sake of accuracy, you're missing some 
> includes:

I omitted them on purpose. It seems to work just fine without them. I'm 
guessing Glibc is coded in such a way that those includes are 
automatically pulled in? Or maybe GCC is smart enough to figure it out?

But yeah we'd do things right of course when we actually do anything. It 
was just a Proof Of Concept :)

> As far as executing, I suppose you could just have the server pass 
> whatever text it receives from the client (except if it's in a special 
> format) to a system call. Of course, eventually we'd want to figure out 
> some authentication.

There are a few ways that come to mind. Client can send one command at a 
time but that might become problematic when it comes to environment 
variables that will get lost. It's probably better for client to send an 
entire shell script, send a special "end of script" marker so the server 
knows when it can execute that script.

Or, maybe client will send XML to server and we'll have to add some XML 
parsing. There are benefits to doing the XML parsing on the client side 
too so the server can remain dumb. Then again, a dumb client is easier 
to code so anybody can write an ALFS client app and we'll have the 
intelligent server figure things out. There's pros and cons to 
everything as usual. I'm trying not to get to that point yet.

Gerard Beekmans

/* If Linux doesn't have the solution, you have the wrong problem */

More information about the alfs-discuss mailing list