OnResolveReply ( ServiceRef sdRef, ServiceFlags flags, int interfaceIndex, ErrorCode errorCode, String fullName, String hostName, int port, Byte[] txtRecord ) { if (errorCode == ErrorCode.NoError) { ResolveData data = new ResolveData(); data.InterfaceIndex = interfaceIndex; data.FullName = fullName; data.HostName = hostName; data.Port = port; data.TxtRecord = txtRecord; Invoke(resolveServiceCallback, new Object[] { data }); } else { MessageBox.Show("OnResolveReply returned an error code: " + errorCode, "Error"); } }
OnResolveService ( ResolveData data ) { resolver.Dispose(); PeerData peer = (PeerData)comboBox1.SelectedItem; peer.Port = data.Port; try { resolver = DNSService.QueryRecord(0, 0, data.HostName, /* ns_t_a */ 1, /* ns_t_c */ 1, new DNSService.QueryRecordReply(OnQueryRecordReply)); } catch { MessageBox.Show("QueryRecord Failed", "Error"); Application.Exit(); } }
// // OnResolveService // // Called when DNSServices has resolved a service. // // This is called (indirectly) from OnResolveService() // private void OnResolveService( ResolveData data ) { resolver.Dispose(); PeerData peer = (PeerData) comboBox1.SelectedItem; peer.Port = data.Port; try { resolver = DNSService.QueryRecord(0, 0, data.HostName, /* ns_t_a */ 1, /* ns_t_c */ 1, new DNSService.QueryRecordReply(OnQueryRecordReply)); } catch { MessageBox.Show("QueryRecord Failed", "Error"); Application.Exit(); } }
// // OnResolveReply // // Called by DNSServices core as a result of DNSService.Resolve() // call // // This is called from a worker thread by DNSService core. // private void OnResolveReply( ServiceRef sdRef, ServiceFlags flags, int interfaceIndex, ErrorCode errorCode, String fullName, String hostName, int port, Byte[] txtRecord ) { if (errorCode == ErrorCode.NoError) { ResolveData data = new ResolveData(); data.InterfaceIndex = interfaceIndex; data.FullName = fullName; data.HostName = hostName; data.Port = port; data.TxtRecord = txtRecord; Invoke(resolveServiceCallback, new Object[]{data}); } else { MessageBox.Show("OnResolveReply returned an error code: " + errorCode, "Error"); } }