Ejemplo n.º 1
0
		internal FileNodeSocketProxy(URL url)
		{
			container = new ServiceContainer();
			IPEndPoint endPoint = new IPEndPoint(IPAddress.Parse(url.Host), url.Port);
			pool = new SocketPool(container, endPoint);
			chunkCache = new Cache<string, byte[]>(60000); //one minute
		}
Ejemplo n.º 2
0
		public ServiceHost(int servicePort)
		{
			pools = new List<SocketPool>();
			poolsLock = new ReaderWriterLockSlim();
			container = new ServiceContainer();
			this.servicePort = servicePort;
		}
Ejemplo n.º 3
0
        public static void Main(string[] arg)
        {
            int n = 10000;
            ServiceContainer container = new ServiceContainer();
            proxy = new MyProxy(new SocketPool(1, container,
                "127.0.0.1:11885"));
            DateTime start, end;
            TimeSpan duration;
            Param1 param = new Param1();
            param.Id = 10;
            param.UserName = "******";
            Console.WriteLine("Client set value for remote service");
            Stopwatch watch = new Stopwatch();
            watch.Start();
            for (int i = 0; i < n; i++)
            {
                var sucess = proxy.SetValue(i, param);
//                Console.WriteLine(i + sucess.ToString());
            }
            watch.Stop();
            Console.WriteLine(string.Format("Client seted value for remote service. Execution took {0} miliseconds", (float) watch.ElapsedMilliseconds / n));
            /*Console.WriteLine("Client get value from remote service");
            start = DateTime.Now;
            int result = proxy.GetValueSimple();
            end = DateTime.Now;
            duration = end.Subtract(start);
            Console.WriteLine("Client geted from remote service. value = {0}. Execution took {1} miliseconds", result, duration.TotalMilliseconds);
            */
            Console.WriteLine("press anyone key to exit");
            Console.ReadLine();
        }