title: WinError 10049: The requested address is not valid in its context
body: <p>I am trying to make a raw HTTP request in Python and write the response to a file. When I try to bind to the resolved IP Address or domain of the host I get this:</p>
  <blockquote>
  <p>Traceback (most recent call last):</p>
  <pre><code>File &quot;thingy.py&quot;, line 3, in &lt;module&gt;
  
    soc.bind(('168.62.48.183', 80))
  </code></pre>
  <p>OSError: [WinError 10049] The requested address is not valid in its context</p>
  </blockquote>
  <p>I found a <a href="https://stackoverflow.com/questions/17043413/connecting-to-myself-through-my-public-ip-through-tcp">StackOverflow question</a> that had the identical error, but it did not answer my question because it was for a <em>listening</em> socket. Here is my code:</p>
  <pre><code>from socket import *
  soc = socket(AF_INET, SOCK_STREAM)
  soc.bind(('168.62.48.183', 80))
  soc.send('GET /miners/get?file=BFGMiner-3.99-r.1-win32.zip HTTP/1.1\nUser-Agent:MultiMiner/V3\nHost: www.multiminerapp.com\n')
  response = soc.recv()
  respfile = open(&quot;http-response.txt&quot;,&quot;w&quot;)
  respfile.writelines(response)
  respfile.close()
  </code></pre>