title: getaddrinfo error: nodename nor servname provided, or not known
body: <p>When I tryed to get IP address for DNS name with getaddrinfo I got the following error</p>
  
  <blockquote>
    <p>getaddrinfo error: nodename nor servname provided, or not known</p>
  </blockquote>
  
  <p>What does this error means? 
  Is it possible that getaddrinfo can't resole the DNS name?
  But nslookup works fine for this address.  I tryed to call getaddrinfo without port, and without AI_NUMERICSERV flag with the same result.</p>
  
  <p>What is wrong with my call?   OS X 10.11 plaftorm.</p>
  
  <p>This is the sample code </p>
  
  <pre><code>struct addrinfo hints, *servinfo;
  int rv;
  
  printf("hostname: %s port: %s ", hostname, port);
  
  memset(&amp;hints, 0, sizeof hints);
  hints.ai_family = AF_UNSPEC; // use AF_INET6 to force IPv6
  hints.ai_flags=AI_DEFAULT|AI_NUMERICSERV;
  if ( (rv = getaddrinfo( hostname , port , &amp;hints , &amp;servinfo)) != 0)
  {
  
  }
  </code></pre>