Thanks.
This is the scenario: I have a server and a client. The client part of the code is what i posted. The client forks with the parent listening , and child sending requests to the server and not the parent.
Now the question is reduced to: how do i pass the ARGV[0] (environment) to the child's STDIN . I get that some IPC mechanism to be used. I tried with pipes, no luck.
In effect the client should be called with some command-line arg (./client arg) , and not input through STDIN interactively.
Any suggestions please.