You need to open two pipes, one that you connect to stdin of the child process, one that you connect to stdout. You probably also need some way to multiplex input/output in your process.
Another option may be to use a pseudo-terminal, which will give you a two-way communication with the client software that has the pseudoterminal as it's I/O channel - although I'm not quite sure exactly the steps you go through to do this, I'm just suggesting it as I know other programs, such as xterm and ssh uses that method.
The same question has been asked before, and the answer is pretty much what I've described in the first paragraph:
popen simultaneous read and write
(This answer includes some code that looks OK!)