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

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -