/// <summary>
        /// Отправка произвольной синхронной команды на сервер.
        /// </summary>
        /// <param name="command">команда</param>
        /// <returns>полученный ответ</returns>
        public Response ExecuteCommand(Command command)
        {
            Response response = new UnknownResponse(new byte[0]);

            if (sctpClient.IsConnected)
            {
                response = sctpClient.Send(command);
            }
            return(response);
        }
 public void TestPerfCreateNodesSync()
 {
     this.Connect();
     Assert.AreEqual(true, sctpClient.IsConnected);
     for (int count = 0; count < 1000000; count++)
     {
         var command  = new CreateNodeCommand(ElementType.ConstantNode_c);
         var response = (CreateNodeResponse)sctpClient.Send(command);
         Assert.AreEqual(response.Header.ReturnCode, ReturnCode.Successfull, "Убедитесь, что параметр максимальное количество сегментов в файле конфигурации сервера не менее 20");
     }
 }
Beispiel #3
0
        public List <ScAddress> FindApples()
        {
            List <ScAddress> apples = new List <ScAddress>();
            //ищем адресс класса яблоко
            var classAppleAddress = this.FindElementAddress(class_apple);
            //ищем все экземпляры класса яблоко. Вот здесь обычно очень нужно находить подмаски масок элементов и сравнивать их
            var template         = new ConstructionTemplate(classAppleAddress, ElementType.PositiveConstantPermanentAccessArc, ElementType.ConstantNode);
            var cmdFindApples    = new IterateElementsCommand(template);
            var rspIterateAppels = (IterateElementsResponse)client.Send(cmdFindApples);

            //и при итерации добавляем в коллекцию адреса яблок (у нас в примере один, но суть можно уловить)
            foreach (var construction in rspIterateAppels.Constructions)
            {
                apples.Add(construction[2]);
            }

            return(apples);
        }