public void FindHosts(ApplicationDescription applicationDescription, Address hostAddress, Address deviceInformation, NetworkPacket userEnumData, int count, int retryInterval, int timeOut, FindHostsFlags flags, out int asyncHandle) { throw new NotImplementedException(); }
/// <summary> /// We either want to start or stop searching /// </summary> private void btnSearch_Click(object sender, System.EventArgs e) { if (!isSearching) { if (hostAddress != null) { hostAddress.Dispose(); } hostAddress = new Address(); hostAddress.ServiceProvider = deviceAddress.ServiceProvider; // See if we should prompt the user for the remote address if (ConnectWizard.ProviderRequiresPort(hostAddress.ServiceProvider)) { AddressForm addressDialog = new AddressForm(connectionWizard.DefaultPort); addressDialog.ShowDialog(this); // If the user cancelled the address form, abort the search if (addressDialog.DialogResult != DialogResult.OK) { return; } // If a port was specified, add the component if (addressDialog.Hostname != "") { hostAddress.AddComponent(Address.KeyHostname, addressDialog.Hostname); } // If a hostname was specified, add the component if (addressDialog.Port > 0) { hostAddress.AddComponent(Address.KeyPort, addressDialog.Port); } } //Time to enum our hosts ApplicationDescription desc = new ApplicationDescription(); desc.GuidApplication = connectionWizard.ApplicationGuid; // If the user was not already asked for address information, DirectPlay // should prompt with native UI FindHostsFlags flags = 0; if (!ConnectWizard.ProviderRequiresPort(deviceAddress.ServiceProvider)) { flags = FindHostsFlags.OkToQueryForAddressing; } peer.FindHosts(desc, hostAddress, deviceAddress, null, Timeout.Infinite, 0, Timeout.Infinite, flags, out findHostHandle); isSearching = true; btnCreate.Enabled = false; btnSearch.Text = "Stop Search"; } else { btnSearch.Text = "Stopping..."; btnSearch.Enabled = false; if (findHostHandle != 0) { peer.CancelAsyncOperation(findHostHandle); } } }