c++ - What is the simplest way to execute arbitrary process with stdin, stdout forwarded to a socket? -
I am interested in two situations:
- How to do this from C ++?
- How to do it from the system shell
The answer is welcome for Linux, Windows and OSX.
Linux / OSX (actually posix), programming (in any language that has posix calls) General plan:
- Setup a socket ..
-
Fork ()
-
Close (0)
,Close (1)
( No -
dup2 (socket, 0)
,dup2 (socket),
dup2
1) -
exec ()
shell: use nc
. Example in my other answer:
Comments
Post a Comment