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:

  1. Setup a socket ..
  2. Fork ()
  3. Close (0) , Close (1) ( No
  4. dup2 (socket, 0) , dup2 (socket), dup2 1)
  5. exec ()

shell: use nc . Example in my other answer:


Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -