Beispiel #1
0
        public static KxClient GenerateClient(EndpointAddress address)
        {
            var binding = new NetTcpBinding();

            binding.MaxReceivedMessageSize = 2147483647;
            binding.Security.Mode          = SecurityMode.None;
            binding.SendTimeout            = new TimeSpan(0, 10, 0);
            binding.OpenTimeout            = new TimeSpan(0, 10, 0);
            binding.CloseTimeout           = new TimeSpan(0, 10, 0);
            binding.ReceiveTimeout         = new TimeSpan(0, 10, 0);

            var client = new KxClient(binding, address);

            try
            {
                client.Open();
            }
            catch (EndpointNotFoundException e)
            {
                client = null;
                Console.WriteLine("could not connect to Kinect server '{0}'", address);
                throw e;
            }
            return(client);
        }
Beispiel #2
0
        public static List <KxClient> FindServers()
        {
            List <KxClient> clients         = new List <KxClient>();
            var             discoveryClient = new DiscoveryClient(new UdpDiscoveryEndpoint());
            var             findCriteria    = new FindCriteria(typeof(KxServer));

            findCriteria.Duration = new TimeSpan(0, 0, 2);
            _logger.Info("Finding Kinect servers...");
            var services = discoveryClient.Find(findCriteria);

            discoveryClient.Close();
            Console.WriteLine("Found {0} servers", services.Endpoints.Count);
            foreach (var endPoint in services.Endpoints)
            {
                Console.WriteLine(endPoint.Address);
                clients.Add(KxClient.GenerateClient(endPoint.Address));
            }
            return(clients);
        }