I have been working on a similar problem Win32 capturing output from a process that may hang, capturing stdout and stderr from a child proc, must work under windows and unix and there is a good chance the child will hang and have to be killed.
I have a partial solution at Re^4: Win32 capturing output from a process that may hang using threads and non blocking thread queues. This does not however do stderr properly. I have started trying to use open3 for this but have found it a can of worms. Did you get anywhere with the client server socket talking approach ?
Pereant, qui ante nos nostra dixerunt!