Exemplo n.º 1
0
        private static void QueryPtrCallback(IntPtr h, DnsServiceFlags flags, int ifIndex, DnsServiceErrorType errorCode, string fullName, DnsServiceType rrType, DnsServiceClass rrClass, ushort dataLen, byte[] data, uint ttl, IntPtr context)
        {
            Dictionary<string, BonjourDevice> deviceList;
            lock (lookups)
                if (!lookups.TryGetValue(context, out deviceList)) return;

            BonjourDevice device;
            lock (deviceList)
                if (!deviceList.TryGetValue(fullName, out device)) return;

            if (errorCode != DnsServiceErrorType.NoError)
            {
                device.Error = errorCode;
                return;
            }

            device.Host.Address = new IPAddress(data);
            device.IsComplete = true;
        }
Exemplo n.º 2
0
 public static extern DnsServiceErrorType DNSServiceQueryRecord(
     out IntPtr handle, DnsServiceFlags flags, int ifIndex, string fullName,
     [MarshalAs(UnmanagedType.U2)] DnsServiceType rrType, [MarshalAs(UnmanagedType.U2)] DnsServiceClass rrClass,
     DnsServiceQueryRecordReply callback, IntPtr context);
Exemplo n.º 3
0
        private static void QueryPtrCallback(IntPtr h, DnsServiceFlags flags, int ifIndex, DnsServiceErrorType errorCode, string fullName, DnsServiceType rrType, DnsServiceClass rrClass, ushort dataLen, byte[] data, uint ttl, IntPtr context)
        {
            Dictionary <string, BonjourDevice> deviceList;

            lock (lookups)
                if (!lookups.TryGetValue(context, out deviceList))
                {
                    return;
                }

            BonjourDevice device;

            lock (deviceList)
                if (!deviceList.TryGetValue(fullName, out device))
                {
                    return;
                }

            if (errorCode != DnsServiceErrorType.NoError)
            {
                device.Error = errorCode;
                return;
            }

            device.Host.Address = new IPAddress(data);
            device.IsComplete   = true;
        }