Esempio n. 1
0
        public void Test2()
        {
            Logger.Console.Verbose = VerboseLevel.All;

            var netStream = new NetworkStreamSimulator();

            var dbcfg  = new HistorianServerDatabaseConfig("DB", @"C:\Archive", true);
            var server = new HistorianServer(dbcfg);
            var auth   = new SecureStreamServer <SocketUserPermissions>();

            auth.SetDefaultUser(true, new SocketUserPermissions()
            {
                CanRead  = true,
                CanWrite = true,
                IsAdmin  = true
            });

            var netServer = new SnapStreamingServer(auth, netStream.ServerStream, server.Host);

            ThreadPool.QueueUserWorkItem(ProcessClient, netServer);

            var client = new SnapStreamingClient(netStream.ClientStream, new SecureStreamClientDefault(), true);

            var  db  = client.GetDatabase <HistorianKey, HistorianValue>("DB");
            long len = db.Read().Count();

            System.Console.WriteLine(len);

            client.Dispose();
            server.Dispose();
        }
Esempio n. 2
0
        public void Test1()
        {
            Logger.Console.Verbose = VerboseLevel.All;

            NetworkStreamSimulator netStream = new NetworkStreamSimulator();

            HistorianServerDatabaseConfig dbcfg = new HistorianServerDatabaseConfig("DB", @"C:\Archive", true);
            HistorianServer server = new HistorianServer(dbcfg);
            SecureStreamServer <SocketUserPermissions> auth = new SecureStreamServer <SocketUserPermissions>();

            auth.SetDefaultUser(true, new SocketUserPermissions()
            {
                CanRead  = true,
                CanWrite = true,
                IsAdmin  = true
            });

            SnapStreamingServer netServer = new SnapStreamingServer(auth, netStream.ServerStream, server.Host);

            ThreadPool.QueueUserWorkItem(ProcessClient, netServer);

            SnapStreamingClient client = new SnapStreamingClient(netStream.ClientStream, new SecureStreamClientDefault(), true);

            ClientDatabaseBase db = client.GetDatabase("DB");

            client.Dispose();
            server.Dispose();
        }
Esempio n. 3
0
        public void TestWriteServer()
        {
            HistorianKey   key   = new HistorianKey();
            HistorianValue value = new HistorianValue();

            Logger.Console.Verbose = VerboseLevel.All;
            Logger.FileWriter.SetPath(@"C:\Temp\", VerboseLevel.All);

            var netStream = new NetworkStreamSimulator();

            var dbcfg  = new HistorianServerDatabaseConfig("DB", @"C:\Temp\Scada", true);
            var server = new HistorianServer(dbcfg);
            var auth   = new SecureStreamServer <SocketUserPermissions>();

            auth.SetDefaultUser(true, new SocketUserPermissions()
            {
                CanRead  = true,
                CanWrite = true,
                IsAdmin  = true
            });

            var netServer = new SnapStreamingServer(auth, netStream.ServerStream, server.Host);

            ThreadPool.QueueUserWorkItem(ProcessClient, netServer);

            var client = new SnapStreamingClient(netStream.ClientStream, new SecureStreamClientDefault(), false);

            var db = client.GetDatabase <HistorianKey, HistorianValue>("DB");

            for (uint x = 0; x < 1000; x++)
            {
                key.Timestamp = x;
                db.Write(key, value);
                break;
            }

            client.Dispose();
            server.Dispose();
        }