title: Errno 32 Broken pipe, Errno 107 Transport endpoint is not connected python socket
body: <p>My TCP Server is written in Qt 4.7, works well with TCP Client also written in Qt 4.7.</p>
  
  <p>I am trying to connect and communicate with Server with client written in python 2.7.3. I start the Server process via apache http request with <code>subprocess.call(path_to_server)</code>. I am using mod_wsgi 3.3 and django 1.4.</p>
  
  <p>Connection is established without a problem. I am receiving <code>[Errno 32] Broken pipe</code> exception on <code>socket.send()</code> randomly (I can spam same msg for 10 times and it will be sent 0-10 times). Same happens to <code>socket.shutdown()</code> &amp; <code>socket.close()</code>, I can spam disconnect command and it will randomly disconnect, otherwise receiving <code>[Errno 107] Transport endpoint is not connected</code> exception. </p>
  
  <p>netstat -nap says connection is established.</p>
  
  <p>When I try running same client script using python2.7 shell everything works fine.</p>
  
  <p>What am I missing here?</p>
  
  <p><code>EDIT</code>
  Everything works on Windows 7, running same apache,mod_wsgi,python,django configuration. TCP Server is also Windows compatible. Error happens on centos6.2 32bit.</p>