AddressToPtr() public static method

public static AddressToPtr ( IPAddress address ) : IntPtr
address System.Net.IPAddress
return System.IntPtr
Esempio n. 1
0
        public void AddAddress(int iface, Protocol proto, PublishFlags flags, string name, IPAddress address)
        {
            IntPtr addressPtr = Utility.AddressToPtr(address);

            lock (client) {
                int ret = avahi_entry_group_add_address(handle, iface, proto, flags,
                                                        Utility.StringToBytes(name), addressPtr);

                Utility.Free(addressPtr);

                if (ret < 0)
                {
                    client.ThrowError();
                }
            }
        }
        private void Start()
        {
            if (client.Handle == IntPtr.Zero || handle != IntPtr.Zero ||
                (foundListeners.Count == 0 && timeoutListeners.Count == 0))
            {
                return;
            }

            IntPtr addrPtr = Utility.AddressToPtr(address);

            lock (client) {
                handle = avahi_address_resolver_new(client.Handle, iface, proto, addrPtr, flags,
                                                    cb, IntPtr.Zero);

                if (handle == IntPtr.Zero)
                {
                    client.ThrowError();
                }
            }

            Utility.Free(addrPtr);
        }