예제 #1
0
        static void Main(string[] args)
        {
            var logger = new Logger(logLevel: LogLevel.Debug);
            var stats  = new Stats();

            var ip         = ConfigurationManager.AppSettings["ip"];
            var port       = Convert.ToInt32(ConfigurationManager.AppSettings["port"]);
            var ipEndpoint = new IPEndPoint(IPAddress.Any, port);

            var useCompression       = false;
            var compressionThreshold = 131072; //128KB
            var pipeName             = "ServiceWireTestHost";

            var nphost = new NpHost(pipeName, logger, stats);
            var tester = new NetTester();

            nphost.AddService <INetTester>(tester);
            var mytester = new MyTester();

            nphost.UseCompression       = useCompression;
            nphost.CompressionThreshold = compressionThreshold;
            nphost.AddService <IMyTester>(mytester);
            nphost.Open();

            var tcphost = new TcpHost(ipEndpoint, logger, stats);

            tcphost.UseCompression       = useCompression;
            tcphost.CompressionThreshold = compressionThreshold;
            tcphost.AddService <INetTester>(tester);
            tcphost.AddService <IMyTester>(mytester);

            var valTypes = new ValTypes();

            tcphost.AddService <IValTypes>(valTypes);

            tcphost.Open();

            Console.WriteLine("Press Enter to stop the dual host test.");
            Console.ReadLine();

            nphost.Close();
            tcphost.Close();

            Console.WriteLine("Press Enter to quit.");
            Console.ReadLine();
        }
예제 #2
0
        static void Main(string[] args)
        {
            var logger = new Logger(logLevel: LogLevel.Debug);
            var stats = new Stats();

            var ip = ConfigurationManager.AppSettings["ip"];
            var port = Convert.ToInt32(ConfigurationManager.AppSettings["port"]);
            var ipEndpoint = new IPEndPoint(IPAddress.Any, port);

            var useCompression = false;
            var compressionThreshold = 131072; //128KB
            var pipeName = "ServiceWireTestHost";

            var nphost = new NpHost(pipeName, logger, stats);
            var tester = new NetTester();
            nphost.AddService<INetTester>(tester);
            var mytester = new MyTester();
            nphost.UseCompression = useCompression;
            nphost.CompressionThreshold = compressionThreshold;
            nphost.AddService<IMyTester>(mytester);
            nphost.Open();

            var tcphost = new TcpHost(ipEndpoint, logger, stats);
            tcphost.UseCompression = useCompression;
            tcphost.CompressionThreshold = compressionThreshold;
            tcphost.AddService<INetTester>(tester);
            tcphost.AddService<IMyTester>(mytester);

            var valTypes = new ValTypes();
            tcphost.AddService<IValTypes>(valTypes);

            tcphost.Open();

            Console.WriteLine("Press Enter to stop the dual host test.");
            Console.ReadLine();

            nphost.Close();
            tcphost.Close();

            Console.WriteLine("Press Enter to quit.");
            Console.ReadLine();
        }