Exemple #1
0
        void OnNew(object sender, EventArgs e)
        {
            MyServer obj;

            obj = new MyServer();
            obj.Count();
            obj.Count();
        }
Exemple #2
0
        void OnCreateInstance(object sender, EventArgs e)
        {
            ObjectHandle handle;

            handle = Activator.CreateInstance("ServerAssembly", "RemoteServer.MyServer");
            MyServer obj = (MyServer)handle.Unwrap();

            obj.Count();
            obj.Count();
        }
Exemple #3
0
        public void Test_remote()
        {
            //Type serverType = typeof(MyServer);
            Type serverType = typeof(MyServer);

            string url = GetActivationURL();

            RemotingConfiguration.RegisterWellKnownClientType(serverType, url);

            MyServer obj;

            obj = new MyServer();
            obj.Count();
            obj.Count();
        }
Exemple #4
0
        public void multipleを超えたリクエストは破棄される事をcountで確認する()
        {
            const int    multiple = 5;
            const int    port     = 8889;
            const string address  = "127.0.0.1";
            var          ip       = new Ip(address);
            var          oneBind  = new OneBind(ip, ProtocolKind.Tcp);
            Conf         conf     = TestUtil.CreateConf("OptionSample");

            conf.Set("port", port);
            conf.Set("multiple", multiple);
            conf.Set("acl", new Dat(new CtrlType[0]));
            conf.Set("enableAcl", 1);
            conf.Set("timeOut", 3);

            var myServer = new MyServer(conf, oneBind);

            myServer.Start();

            var ar = new List <MyClient>();

            for (int i = 0; i < 20; i++)
            {
                var myClient = new MyClient(address, port);
                myClient.Connet();
                ar.Add(myClient);
            }
            Thread.Sleep(100);

            //multiple以上は接続できない
            Assert.That(myServer.Count(), Is.EqualTo(multiple));

            myServer.Stop();
            myServer.Dispose();

            foreach (var c in ar)
            {
                c.Dispose();
            }
        }
Exemple #5
0
        public void multipleを超えたリクエストは破棄される事をcountで確認する()
        {
            const int multiple = 5;
            const int port = 8889;
            const string address = "127.0.0.1";
            var ip = new Ip(address);
            var oneBind = new OneBind(ip, ProtocolKind.Tcp);
            Conf conf = TestUtil.CreateConf("OptionSample");
            conf.Set("port", port);
            conf.Set("multiple", multiple);
            conf.Set("acl", new Dat(new CtrlType[0]));
            conf.Set("enableAcl", 1);
            conf.Set("timeOut", 3);

            var myServer = new MyServer(conf, oneBind);
            myServer.Start();

            var ar = new List<MyClient>();

            for (int i = 0; i < 20; i++){
                var myClient = new MyClient(address, port);
                myClient.Connet();
                ar.Add(myClient);
            }
            Thread.Sleep(100);

            //multiple以上は接続できない
            Assert.That(myServer.Count(), Is.EqualTo(multiple));

            myServer.Stop();
            myServer.Dispose();

            foreach (var c in ar){
                c.Dispose();
            }
        }