How do I send output from System.out to socket e.g. PrintWriter?
I need to send whatever appears on the console output (both std and err) to PrintWriter, thus a socket.
Thank you.
May be you can try like this:
OutputStream os = socket.getOutputStream(); // for example
PrintStream ps = new PrintStream(os);
System.setOut(ps);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With