Process() public method

public Process ( ) : void
return void
示例#1
0
        public void ProcessRegister()
        {
            ushort txt_rec_length = 0;

            byte [] txt_rec = null;

            if (TxtRecord != null)
            {
                txt_rec_length = ((TxtRecord)TxtRecord.BaseRecord).RawLength;
                txt_rec        = new byte[txt_rec_length];
                Marshal.Copy(((TxtRecord)TxtRecord.BaseRecord).RawBytes, txt_rec, 0, txt_rec_length);
            }

            _self = GCHandle.Alloc(this);
            ServiceError error = Native.DNSServiceRegister(out sd_ref,
                                                           auto_rename ? ServiceFlags.None : ServiceFlags.NoAutoRename, InterfaceIndex,
                                                           Name, RegType, ReplyDomain, HostTarget, (ushort)IPAddress.HostToNetworkOrder((short)port), txt_rec_length, txt_rec,
                                                           register_reply_handler, GCHandle.ToIntPtr(_self));

            if (error != ServiceError.NoError)
            {
                throw new ServiceErrorException(error);
            }

            sd_ref.Process();
        }
示例#2
0
        public void ProcessRegister()
        {
            ushort txt_rec_length = 0;

            byte [] txt_rec = null;

            if (TxtRecord != null)
            {
                txt_rec_length = ((TxtRecord)TxtRecord.BaseRecord).RawLength;
                txt_rec        = new byte[txt_rec_length];
                Marshal.Copy(((TxtRecord)TxtRecord.BaseRecord).RawBytes, txt_rec, 0, txt_rec_length);
            }

            ServiceError error = Native.DNSServiceRegister(out sd_ref,
                                                           auto_rename ? ServiceFlags.None : ServiceFlags.NoAutoRename, InterfaceIndex,
                                                           Name, RegType, ReplyDomain, HostTarget, port, txt_rec_length, txt_rec,
                                                           register_reply_handler, IntPtr.Zero);

            if (error != ServiceError.NoError)
            {
                throw new ServiceErrorException(error);
            }

            sd_ref.Process();
        }
        internal void ProcessRegister()
        {
            ushort txt_rec_length = 0;

            byte [] txt_rec = null;

            if (TxtRecord != null)
            {
                txt_rec_length = ((TxtRecord)TxtRecord.BaseRecord).RawLength;
                txt_rec        = new byte[txt_rec_length];
                Marshal.Copy(((TxtRecord)TxtRecord.BaseRecord).RawBytes, txt_rec, 0, txt_rec_length);
            }

            _self = GCHandle.Alloc(this);
            Log.To.Discovery.V(Tag, "{0} preparing to enter DNSServiceRegister");
            ServiceError error = Native.DNSServiceRegister(out sd_ref,
                                                           auto_rename ? ServiceFlags.None : ServiceFlags.NoAutoRename, InterfaceIndex,
                                                           Name, RegType, ReplyDomain, HostTarget, (ushort)IPAddress.HostToNetworkOrder((short)Port), txt_rec_length, txt_rec,
                                                           register_reply_handler, GCHandle.ToIntPtr(_self));

            if (error != ServiceError.NoError)
            {
                Log.To.Discovery.W(Tag, "Got error in DNSServiceRegister {0}", error);
                Error(this, new ServiceErrorEventArgs("ProcessRegister", error));
                sd_ref.Deallocate();
                return;
            }

            sd_ref.Process();
        }
示例#4
0
        private void ProcessStart()
        {
            _self = GCHandle.Alloc(this);
            ServiceError error = ServiceError.NoError;

            try {
                error = Native.DNSServiceBrowse(out sd_ref, ServiceFlags.Default,
                                                interface_index, regtype, domain, browse_reply_handler, GCHandle.ToIntPtr(_self));
            } catch (DllNotFoundException) {
                Log.E(TAG, "Unable to find required DLL file:  dnssd.dll\n" +
                      "(Windows -> Is Bonjour installed?)\n" +
                      "(Linux -> Are the network support files in place?)\n" +
                      "(Others -> Is a dll.config file included?)");
                error = ServiceError.BadState;
            }

            if (error != ServiceError.NoError)
            {
                if ((int)error == -65563)
                {
                    Log.E(TAG, "mDNS daemon not started");
                }

                throw new ServiceErrorException(error);
            }

            sd_ref.Process();
        }
示例#5
0
        private void ProcessStart()
        {
            ServiceError error = Native.DNSServiceBrowse(out sd_ref, ServiceFlags.Default,
                                                         interface_index, regtype, domain, browse_reply_handler, IntPtr.Zero);

            if (error != ServiceError.NoError)
            {
                throw new ServiceErrorException(error);
            }

            sd_ref.Process();
        }
示例#6
0
        private void ProcessStart()
        {
            _self = GCHandle.Alloc(this);
            ServiceError error = ServiceError.NoError;

            try {
                error = Native.DNSServiceBrowse(out sd_ref, ServiceFlags.Default,
                                                interface_index, regtype, domain, browse_reply_handler, GCHandle.ToIntPtr(_self));
            } catch (DllNotFoundException) {
                Log.E(TAG, "Unable to find required DLL file:  dnssd.dll\n(Windows -> Is Bounjour installed?)\n(Others -> Is a dll.config file included?)");
                error = ServiceError.Invalid;
            }

            if (error != ServiceError.NoError)
            {
                throw new ServiceErrorException(error);
            }

            sd_ref.Process();
        }