title: how to broadcast in LAN with GCDAsyncUdpSocket?
body: <p>I want to discover whether there is a server, which is listening to a specific port, in the LAN with unknown IP address with <a href="https://github.com/robbiehanson/CocoaAsyncSocket" rel="nofollow">GCDAsyncUdpSocket</a>. I will broadcast some message in the LAN, and if the server exists, it will feedback a message then i will know the server's IP address.</p>
  
  <p>Now I try to use the the following code to do the work:</p>
  
  <pre><code>udpSocket = [[GCDAsyncUdpSocket alloc] initWithDelegate:self delegateQueue:dispatch_get_main_queue()];
  
  if (![udpSocket bindToPort:18686 error:&amp;error])
  {
      [self logError:FORMAT(@"Error binding: %@", error)];
      return;
  }
  
  if (![udpSocket beginReceiving:&amp;error])
  {
      [self logError:FORMAT(@"Error receiving: %@", error)];
      return;
  }
  
  NSString *host = @"192.168.2.139"; // server IP i know
  int port = 8585;
  NSString *message = @"Hello";
  NSData *data = [msg dataUsingEncoding:NSUTF8StringEncoding];
  [udpSocket sendData:data toHost:host port:port withTimeout:-1 tag:tag];
  </code></pre>
  
  <p>If i set the host IP to server IP, its all right, server will response. But i want to broadcast to find the server IP, and i try to use "192.168.2.0","192.168.2.1","192.168.2.255","255.255.255.255", all above address can not broadcast.</p>
  
  <p>I wonder which IP address i can use to broadcast in LAN with 192.168.2.*, and which IP address to broadcast if don't know the LAN IP domain? Any help will be appreciated.</p>