I'm trying to exec() a program from my server, and attach my

  If the program you are running uses printf(), etc (streams from
  stdio.h) you have to deal with two buffers.  The kernel buffers all
  socket IO, and this is explained in ``section 2.11''.  The second
  buffer is the one that is causing you grief.  This is the stdio
  buffer, and the problem was well explained by Andrew:

  (The short answer to this question is that you want to use a pty
  rather than a socket; the remainder of this article is an attempt to
  explain why.)

  Firstly, the socket buffer controlled by setsockopt() has absolutly
  nothing to do with stdio buffering. Setting it to 1 is guaranteed to
  be the Wrong Thing(tm).
  Perhaps the following diagram might make things a little clearer:

               Process A                   Process B

Suggest a Site