title: Reading text from website using sockets Python
body: <p>I am trying to go to <a href="http://www.py4inf.com/code/romeo.txt" rel="nofollow noreferrer">http://www.py4inf.com/code/romeo.txt</a>, read the contents of romeo.txt and print them back out, am using python 3.6.1.</p>
  
  <pre><code>import socket
  
  mysock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  mysock.connect(('www.py4inf.com', 80))
  mysock.send('GET http://www.py4inf.com/code/romeo.txt HTTP/1.0\n\n'.encode("utf8"))
  
  while True:
      data = mysock.recv(512)
      if ( len(data) &lt; 1 ) :
          break
      print (data.decode("utf8"))
  
  mysock.close()
  </code></pre>
  
  <p>instead of the contents of the page it prints out </p>
  
  <pre><code>TTP/1.1 404 Not Found
  Server: nginx
  Date: Wed, 21 Jun 2017 03:00:15 GMT
  Content-Type: text/html
  Content-Length: 162
  Connection: close
   &lt;html&gt;
  &lt;head&gt;&lt;title&gt;404 Not Found&lt;/title&gt;&lt;/head&gt;
  &lt;body bgcolor="white"&gt;
  &lt;center&gt;&lt;h1&gt;404 Not Found&lt;/h1&gt;&lt;/center&gt;
  &lt;hr&gt;&lt;center&gt;nginx&lt;/center&gt;
  &lt;/body&gt;
  &lt;/html
  </code></pre>
  
  <p>Why is this? Thanks in advance</p>