Mono.Zeroconf.Providers.Bonjour.BrowseService.OnResolveReply C# (CSharp) Method

OnResolveReply() private method

private OnResolveReply ( ServiceRef sdRef, ServiceFlags flags, uint interfaceIndex, ServiceError errorCode, string fullname, string hosttarget, ushort port, ushort txtLen, IntPtr txtRecord, IntPtr contex ) : void
sdRef ServiceRef
flags ServiceFlags
interfaceIndex uint
errorCode ServiceError
fullname string
hosttarget string
port ushort
txtLen ushort
txtRecord System.IntPtr
contex System.IntPtr
return void
        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;
            this.port = port;
            TxtRecord = new TxtRecord(txtLen, txtRecord);

            sdRef.Deallocate();

            // Run an A query to resolve the IP address
            ServiceRef sd_ref;

            if (AddressProtocol == AddressProtocol.Any || AddressProtocol == AddressProtocol.IPv4) {
                ServiceError error = Native.DNSServiceQueryRecord(out sd_ref, ServiceFlags.None, interfaceIndex,
                    hosttarget, ServiceType.A, ServiceClass.IN, query_record_reply_handler, IntPtr.Zero);

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

                sd_ref.Process();
            }

            if (AddressProtocol == AddressProtocol.Any || AddressProtocol == AddressProtocol.IPv6) {
                ServiceError error = Native.DNSServiceQueryRecord(out sd_ref, ServiceFlags.None, interfaceIndex,
                    hosttarget, ServiceType.A6, ServiceClass.IN, query_record_reply_handler, IntPtr.Zero);

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

                sd_ref.Process();
            }
        }