예제 #1
0
        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");
            }
        }
예제 #2
0
        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();
            }
        }
예제 #3
0
        //
        // 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();
            }
        }
예제 #4
0
        //
        // 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");
            }
        }