title: GCDWebServer via Hotspot network
body: <p>I'm developing an application where devices can connect and interact with each other via common wi-fi network and for the purpose of file exchange I'm using <code>GCDWebServer</code>.</p>
  
  <p>Everything is working great when I use usual wi-fi network or devices are connected to hotspot network with 3rd party host. But I encounter a strange issue when one of devices with the launched app is actually a host of a Hotspot.</p>
  
  <p>I have this code:</p>
  
  <pre><code>- (void)startStreamHLSServer
  {
      dispatch_async(dispatch_get_main_queue(), ^{
          if (!_webServer.isRunning)
          {
              _webServer = [GCDWebServer new];
              [_webServer addGETHandlerForBasePath:@"/" directoryPath:[_fileManager videosURL].path indexFilename:nil cacheAge:3600 allowRangeRequests:YES];
  
              [_webServer startWithPort:1000 bonjourName:nil];
  
              NSLog(@"URL: %@", _webServer.serverURL.absoluteString);
          }
      });
  }
  </code></pre>
  
  <p>The problem is that serverURL is <code>nil</code>. Which actually seems logical because I checked a function <code>GCDWebServerGetPrimaryIPAddress</code> which is supposed to tell the address and this function is only looking for addresses in the <code>en0</code> interface when Hotspot network is actually <code>bridge100</code>.</p>
  
  <p>So question is - Is there a "normal" way to make GCDWebServer work with <code>bridge100</code>?</p>
  
  <p><strong>SECOND PART:</strong></p>
  
  <p>Although <code>serverURL</code> is nil, method <code>startWithPort</code> returns <code>true</code>. So I thought maybe server is running, it just can not tell me its address. So I got device's address with my custom method (if you're interested, I can attach it here, but I'm 100% sure it gives a correct address) and tried to use it in order to "speak" with web server, but no luck with that - server doesn't respond. So maybe <code>startWithPort</code> returns a false result after all.</p>
  
  <p>Very interesting observation - when I change <code>primaryInterface</code> to <code>bridge100</code> in <code>GCDWebServerGetPrimaryIPAddress</code> method, it fixes the issue. <code>GCDWebServer</code> shows a correct address and it is definitely running since I can have an access to the device folder.</p>
  
  <p>Any help would be appreciated!</p>