public void Dispose()
        {
            if (thread != null)
            {
                thread.Abort();
                thread = null;
            }

            sd_ref.Deallocate();
        }
Esempio n. 2
0
        public void Stop()
        {
            if (sd_ref != ServiceRef.Zero)
            {
                sd_ref.Deallocate();
                sd_ref = ServiceRef.Zero;
            }

            if (thread != null)
            {
                thread.Abort();
                thread = null;
            }
        }
        private void OnResolveReply(ServiceRef sdRef, ServiceFlags flags, uint interfaceIndex,
                                    ServiceError errorCode, string fullname, string hosttarget, ushort port, ushort txtLen,
                                    IntPtr txtRecord, IntPtr contex)
        {
            is_resolved     = true;
            resolve_pending = false;

            InterfaceIndex = interfaceIndex;
            FullName       = fullname;
            HostTarget     = hosttarget;
            this.port      = (short)port;
            TxtRecord      = new TxtRecord(txtLen, txtRecord);

            EventHandler handler = Resolved;

            if (handler != null)
            {
                handler(this, new EventArgs());
            }

            sdRef.Deallocate();
        }
        private void OnResolveReply(ServiceRef sdRef, ServiceFlags flags, uint interfaceIndex,
            ServiceError errorCode, string fullname, string hosttarget, ushort port, ushort txtLen, 
            IntPtr txtRecord, IntPtr contex)
        {
            is_resolved = true;
            resolve_pending = false;

            InterfaceIndex = interfaceIndex;
            FullName = fullname;
            HostTarget = hosttarget;
            this.port = (short)port;
            TxtRecord = new TxtRecord(txtLen, txtRecord);

            EventHandler handler = Resolved;
            if(handler != null) {
                handler(this, new EventArgs());
            }

            sdRef.Deallocate();
        }