title: Communicating multiple times w/ subprocess (multiple calls to stdout)
body: <p>There's a similar question to mine on [this thread][1].</p>
  
  <p>I want to send a command to my subprocess, interpret the response, then send another command.  It would seem a shame to have to start a new subprocess to accomplish this, particularly if  subprocess2 must perform many of the same tasks as subprocess1 (e.g. ssh, open mysql).</p>
  
  <p>I tried the following:</p>
  
  <pre><code>subprocess1.stdin.write([my commands])
  subprocess1.stdin.flush()
  subprocess1.stout.read()
  </code></pre>
  
  <p>But without a definite parameter for bytes to <code>read()</code>, the program gets stuck executing that instruction, and I can't supply an argument for <code>read()</code> because I can't guess how many bytes are available in the stream.</p>
  
  <p>I'm running WinXP, Py2.7.1</p>
  
  <h2>EDIT</h2>
  
  <p>Credit goes to @regularfry for giving me the best solution for my real intention (read the comments in his response, as they pertain to accomplishing my goal through an SSH tunnel).  (His/her answer has been voted up.)  For the benefit of any viewer who hereafter comes for an answer to the title question, however, I've accepted @Mike Penningtion's answer.</p>