public void ReceiveCallback(IAsyncResult args) { UdpClient u = ((State)(args.AsyncState)).udpClient; IPEndPoint e = ((State)(args.AsyncState)).Endpoint; Byte[] receiveBytes = u.EndReceive(args, ref e); string s = Encoding.ASCII.GetString(receiveBytes); if (ChorusHubInfo.IsChorusHubInfo(s)) { _foundHub = ChorusHubInfo.Parse(s); } }
public ChorusHubInfo Find() { _foundHub = null; Start(); for (int i = 0; i < 20; i++) { if (_foundHub != null) { break; } Thread.Sleep(200); } Stop(); return(_foundHub); //will be null if none found }