Beispiel #1
0
        public BasicRunTests()
        {
            server = new SimpleRpcServer();
            var rpcFunctions = new SimpleDUTRemote.Functions();

            server.Register(rpcFunctions);
            serverTask = server.Start();
        }
Beispiel #2
0
        public ClientTests()
        {
            server = new SimpleRpcServer();
            var rpcFunctions = new SimpleDUTRemote.Functions();

            server.Register(rpcFunctions);
            serverTask = server.Start();
            client     = new RpcClient("127.0.0.1", 8000);
        }
Beispiel #3
0
        public void RpcServer_StopServer()
        {
            var altServer    = new SimpleRpcServer();
            var rpcFunctions = new SimpleDUTRemote.Functions();

            altServer.Register(rpcFunctions);
            var serverTask = altServer.Start(9000);

            Thread.Sleep(500);
            altServer.Stop();

            var finished = serverTask.Wait(1000);

            Assert.IsTrue(finished, "Server did not stop.");
        }
Beispiel #4
0
        static void InitializeServer(string[] args)
        {
            Logger logger = LogManager.GetCurrentClassLogger();

            // determine server port number (default to 8000 unless --port is specified)
            int portNumber = 8000;
            int broadcastPort;

            if (args.Contains("--port"))
            {
                var portArgNumber = Array.IndexOf(args, "--port") + 1;
                int.TryParse(args[portArgNumber], out portNumber);
            }

            // determine broadcast port (default to server port + 1 unless --broadcastPort is specified)
            if (args.Contains("--broadcastPort"))
            {
                var bcastArgNumber = Array.IndexOf(args, "--broadcastPort") + 1;
                int.TryParse(args[bcastArgNumber], out broadcastPort);
            }
            else
            {
                broadcastPort = portNumber + 1;
            }

            Console.WriteLine("Starting Simple Remote on this system...");
            Console.WriteLine($"You can connect on {Dns.GetHostName()}:{portNumber}");
            foreach (var ip in GetLocalIPAddresses())
            {
                Console.WriteLine($"You can also use {ip.Item2}:{portNumber} ({ip.Item1})");
            }
            Console.WriteLine();

            // create our object that has our functions
            var remotes = new Functions();

            // create our server object and register our functions
            var server = new SimpleRpcServer();

            server.Register(remotes);

            Console.WriteLine("Now ready for connections; press Ctrl+C to exit.");
            serverTask = server.Start(portNumber, null, broadcastPort);
        }