Consider this code:

Code:
#include <unistd.h>     //dup2, STDIN_FILENO, STDERR_FILENO

int main(void)
{
  dup2(STDIN_FILENO, STDOUT_FILENO);
  while(1);
  return 0;
}
Basically, I'm trying to redirect stdin into stdout.
The way I am trying to do this is directly - Any message coming in through the input socket fb goes directly into the stdout socket fb without buffering anything in memory in my program.
dup2 copies over socket so STDIN and STDOUT were the same. I was hoping this would allow for any signal coming from STDIN to go to STDOUT.

Unfortunately this does not work. Is there any way possible to get this to work?
This would be a good optimization over buffering it in between..
I know it may sound impossible due to some limitation in linux, but I want to see if there is something I don't know that may enable it.
Maybe blocking vs nonblocking mode? Or something else?