/// <summary>
 /// Constructor
 /// </summary>
 /// <param name="MySQLConn"></param>
 public ConnectivityBasedPositioning(MySQLClass MySQLConn)
     : base(MySQLConn)
 {
 }
示例#2
0
        public void TestADBConnection()
        {
            MySQLClass DBInstance = SingletonObjects.DB;

            Assert.IsTrue(DBInstance.ConnectionTest());
        }
示例#3
0
        public void TCPServerStart()
        {
            string message;

            TcpListener server = null;

            try
            {
                IPAddress localAddr = IPAddress.Parse("127.0.0.1");
                server = new TcpListener(localAddr, port);

                // запуск слушателя
                server.Start();

                // Buffer for reading data
                Byte[] bytes = new Byte[256];
                String data  = null;

                while (true)
                {
                    Console.WriteLine("Ожидание подключений... ");

                    // получаем входящее подключение
                    TcpClient client = server.AcceptTcpClient();
                    Console.WriteLine("Подключен клиент. Выполнение запроса...");
                    // получаем сетевой поток для чтения и записи
                    NetworkStream stream = client.GetStream();

                    //Не читается сообщение
                    int i;
                    data = null;

                    // Loop to receive all the data sent by the client.
                    while ((i = stream.Read(bytes, 0, bytes.Length)) != 0)
                    {
                        // Translate data bytes to a ASCII string.
                        data = System.Text.Encoding.UTF8.GetString(bytes, 0, i);
                        Console.WriteLine("Received: {0}", data);

                        List <long?> idList = MySQLClass.GetVKID();

                        //Read messages from PLUGIN CHAT -> Send TO BOT Community VK
                        foreach (long?id in idList)
                        {
                            LPListener.SendMessage(data, id);

                            Thread.Sleep(delay * 1000);
                        }
                    }

                    // получаем сообщение
                    StringBuilder builder = new StringBuilder();
                    //
                    Thread.Sleep(delay * 1000);
                    // закрываем поток

                    client.Close();
                }
            }
            catch (SocketException e)
            {
                Console.WriteLine("SocketException: {0}", e);
            }
            finally
            {
            }
        }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="WsnId">WsnId of this node</param>
 /// <param name="MyDb">Connectionstring to use for the connection to the database (MySQL!)</param>
 public Node(string WsnId, MySQLClass MyDb)
 {
     this.MyDb     = MyDb;
     this.WsnId    = WsnId;
     this.position = new Point(0.00, 0.00);
 }