I am trying to create a tester to check a server-client application assignment.
When I try to run the server in the background I can not properly start clients - one different terminals I do manage. I am looking for a mechansim to automatically create
a server and a few clients and to inject input (messages etc. ) into the different clients and then automatically check that the correct output was printed out.
I tried doing this using different processes - i.e. a fork function and then running
- system("createclient ... < input ") but I have a few problems /questions -
a. I have control only over the initial "input" - because once I run the system command- the client which is an interactive one - keeps waiting for inputs from stdin and does not return to the process that created it - is there a way to "inject" input into a process (using the process id) from another process ?
b. Some times - when the input includes a series of commands the client only executes the first (at other time he does execute all of them) - any idea why this could happen ?
c. Is there a better way to simulate this test where I have more control over what is going on ?


I suggest you use PostThreadMessage()(Windows only)
and parse that message in the WindProc of the client.
Point 'b' beats me. 'c' should be achievable from answer to 'a'.