public void ProcessRegister()
        {
            ushort txt_rec_length = 0;

            byte [] txt_rec = null;

            if (TxtRecord != null)
            {
                txt_rec_length = TxtRecord.RawLength;
                txt_rec        = new byte[txt_rec_length];
                Marshal.Copy(TxtRecord.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, (ushort)port, txt_rec_length, txt_rec,
                                                           OnRegisterReply, IntPtr.Zero);

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

            sd_ref.Process();
        }
Пример #2
0
        private void ProcessStart()
        {
            ServiceError error = Native.DNSServiceBrowse(out sd_ref, ServiceFlags.Default,
                                                         interface_index, regtype, domain, OnBrowseReply, IntPtr.Zero);

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

            sd_ref.Process();
        }