I'd like to know how I can redirect the input and output of a system process over a TCP connection from the server-side. This would result in the client being able to interact with said process.
So far I know how to actually establish a simple TCP connection, and I can get the input and output streams of the connection socket using the getInputStream()
and getOutputStream()
methods.
I can also get the output and input streams of a Process (after initializing the process via ProcessBuilder.start()
method) using its getInputStream()
and getOutputStream()
methods.
So I end up with two sets of input and output streams. What I want to know is how to connect (may be using the wrong word here) the output and input streams of the Process with the output stream of the connection socket, so that the client on the other side of the TCP connection can interact with the Process.
If it matters, I'm using BufferedInputStream
s and BufferedOutputStream
s.
Any information regarding this problem is greatly appreciated, thanks!