title: Broken Pipe Error python while trying to netcat large file into termbin.com
body: <p>I am working a new command line tool <a href="https://github.com/a7i7/HoldMyFile" rel="nofollow">https://github.com/a7i7/HoldMyFile</a> .
  But I am facing some problem with the following function:</p>
  
  <pre><code>def netcat(hostname, port, content):
      s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
      s.connect((hostname, port))
      s.sendall(content)
      s.shutdown(socket.SHUT_WR)
      response = ''
      while 1:
          data = s.recv(1024)
          if data == "":
              break
          data = repr(data)
          response = response + data
      s.close()
      response = response[:-3][1:]
      return response
  </code></pre>
  
  <p>Whenever I call netcat('termbin.com',9999,content) and content has around 1 MB of data in it, the code exits with the following error message "socket.error: [Errno 32] Broken pipe" . 
  Now if I send 1 MB of data from the linux shell using 
  <code>cat data.txt | nc termbin.com 9999</code> all the data is successfully sent. 
  I even tried running the same command from the linux shell using os.system from python. still the broken pipe error is encountered. Kindly help me fix this</p>