title: NSURLSession fails when attempting to us assigned IP instead of localhost or home
body: <p>I have a server running locally (my IP is 192.168.0.98) and have been experimenting with some networking code to access it. Originally this was done via AFNetworking, but I've now done it with a <code>NSURLSession</code> like this:</p>
  
  <pre><code>NSURLSession *session = [NSURLSession sharedSession];
  NSURL *url = [NSURL URLWithString:@"http://192.168.0.98:8080/api"];
  NSURLSessionDataTask *task = [session dataTaskWithURL: url
                                      completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
                                          NSLog(@"Error: %@", error);
                                          NSLog(@"Body: %@", [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]);
                                      }];
  [task resume];
  </code></pre>
  
  <p>I've then run it with these 3 URLs:</p>
  
  <ul>
  <li><code>http://localhost:8080/api</code> -> works. </li>
  <li><code>http://127.0.0.1:8080/api</code> -> works. </li>
  <li><p><code>http://192.168.0.98:8080/api</code> -> fails with the error: </p>
  
  <pre><code>Error Domain=NSPOSIXErrorDomain 
  Code=2 "No such file or directory" 
  UserInfo={
      NSErrorFailingURLStringKey=http://192.168.0.98:8080/api,
      NSErrorFailingURLKey=http://192.168.0.98:8080api,
      _kCFStreamErrorCodeKey=2,
      _kCFStreamErrorDomainKey=1
  }
  </code></pre></li>
  </ul>
  
  <p>Where 192.168.0.98 is the IP assigned to this machine. If I run these URLs from <a href="https://luckymarmot.com/paw" rel="noreferrer">PAW</a> or a browser it works just fine. But from a unit test it fails.</p>
  
  <p>From my project's perspective I can just use <code>localhost</code>. So this is not a deal breaker. But I'm curious as to why it's not working.</p>
  
  <p>Does anyone have any idea what the issue might be?  </p>