title: Python socket send EOF
body: <p>I have a simple file transfer socket program where one socket sends file data and another socket receives the data and writes to a file<br><br>
  I need to send an <b>acknowledgment</b> once transfer is finished from the destination to the source<br>
  <br>
  Code for destination</p>
  
  <pre><code>s.accept()
  f = s.makefile()
  f.read(1024)
  </code></pre>
  
  <p>Code for source<br></p>
  
  <pre><code>s.connect(('localhost',6090))
  f = s.makefile()
  f.write('abcd') 
  f.flush()
  </code></pre>
  
  <p>Here comes the problem, since "abcd" is not 1024 bytes, the destination will block till 1024 bytes are received<br>
  The solution would be to <b>close()</B> the socket, but since I need a confirmation from destination, I cannot close the socket.<br>
  How do I tell the destination to stop blocking? I was thinking of writing an EOF character 
  I read online that "\x04" is EOF, but it doesn't work. <br>Also since the data could be binary I don't want to use the readline() method. <br></p>