コード例 #1
0
        private void DoDiscovery()
        {
            // setup zeroconf, if available
            Zeroconf zc = null;

            if (Zeroconf.CheckAvailability())
            {
                zc = new Zeroconf();
                zc.StartDiscovery(delegate(string ip, int port, string meta)
                {
                    lock (waitingTasks)
                    {
                        waitingTasks.Add(Task.Factory.StartNew(() => FoundAddress(meta)));
                    }
                });
            }

            // do all hinted ports
            lock (waitingTasks)
            {
                foreach (string ip in hintedAddresses)
                {
                    waitingTasks.Add(Task.Factory.StartNew(() => FoundAddress(String.Format("http://{0}:{1}/", ip, DEFAULT_PORT))));
                }
            }
        }
コード例 #2
0
        private void DoDiscovery()
        {
            // setup zeroconf, if available
            Zeroconf zc = null;
            if(Zeroconf.CheckAvailability())
            {
                zc = new Zeroconf();
                zc.StartDiscovery(delegate(string ip, int port, string meta)
                {
                    lock (waitingTasks)
                    {
                        waitingTasks.Add(Task.Factory.StartNew(() => FoundAddress(meta)));
                    }
                });
            }

            // do all hinted ports
            lock (waitingTasks)
            {
                foreach (string ip in hintedAddresses)
                {
                    waitingTasks.Add(Task.Factory.StartNew(() => FoundAddress(String.Format("http://{0}:{1}/", ip, DEFAULT_PORT))));
                }
            }
        }