public NewRedisClient0(IPEndPoint point)
        {
            _protocalStart = (byte)43;
            _store         = new TaskLink <bool>();
            _taskLink      = _store;
            _head          = _taskLink;
            SocketConnectionFactory client = new SocketConnectionFactory(new SocketTransportOptions());

            _connection = client.ConnectAsync(point).Result;
            _sender     = _connection.Transport.Output;
            _reciver    = _connection.Transport.Input;
            RunReciver();
            //Task.Run(async () => {
            //    await Task.Delay(30000);
            //    Console.WriteLine(total);
            //    Console.WriteLine(_receiverQueue.Count);
            //    await Task.Delay(20000);
            //    Console.WriteLine(total);
            //    Console.WriteLine(_receiverQueue.Count);
            //    await Task.Delay(10000);
            //    Console.WriteLine(total);
            //    Console.WriteLine(_receiverQueue.Count);
            //});
            //RunSender();
        }
Esempio n. 2
0
        public NewRedisClient1(IPEndPoint point)
        {
            _protocalStart = (byte)43;
            _array         = new TaskCompletionSource <bool> [TASK_BUFFER_LENGTH];
            for (int i = 0; i < TASK_BUFFER_LENGTH; i++)
            {
                _array[i] = new TaskCompletionSource <bool>();
            }
            _receiverQueue = new Queue <TaskCompletionSource <bool> >();
            SocketConnectionFactory client = new SocketConnectionFactory(new SocketTransportOptions());

            _connection = client.ConnectAsync(point).Result;
            _sender     = _connection.Transport.Output;
            _reciver    = _connection.Transport.Input;
            RunReciver();
            //Task.Run(async () => {
            //    await Task.Delay(30000);
            //    Console.WriteLine(total);
            //    Console.WriteLine(_receiverQueue.Count);
            //    await Task.Delay(20000);
            //    Console.WriteLine(total);
            //    Console.WriteLine(_receiverQueue.Count);
            //    await Task.Delay(10000);
            //    Console.WriteLine(total);
            //    Console.WriteLine(_receiverQueue.Count);
            //});
            //RunSender();
        }
Esempio n. 3
0
        public NewRedisClient(IPEndPoint point)
        {
            _taskQueue = new ConcurrentQueue <TaskCompletionSource <string> >();
            SocketConnectionFactory client = new SocketConnectionFactory(new SocketTransportOptions());

            _connection = client.ConnectAsync(point).Result;
            _sender     = _connection.Transport.Output;
            _reciver    = _connection.Transport.Input;
            RunReciver();
        }
Esempio n. 4
0
        public NewRedisClient4(IPEndPoint point)
        {
            _protocalStart = (byte)43;
            SocketConnectionFactory client = new SocketConnectionFactory(new SocketTransportOptions());

            _connection    = client.ConnectAsync(point).Result;
            _sender        = _connection.Transport.Output;
            _reciver       = _connection.Transport.Input;
            _receiverQueue = new SourceConcurrentQueue2 <TaskCompletionSource <bool> >(_sender);
            RunReciver();
        }
Esempio n. 5
0
        public NewRedisClient3(IPEndPoint point)//, ConcurrentStack<NewRedisClient3> pool)
        {
            _protocalStart = (byte)43;
            //_pool = pool;
            SocketConnectionFactory client = new SocketConnectionFactory(new SocketTransportOptions());

            _connection    = client.ConnectAsync(point).Result;
            _sender        = _connection.Transport.Output;
            _reciver       = _connection.Transport.Input;
            _receiverQueue = new SourceConcurrentQueue <Task <bool> >(_sender);
            RunReciver();
        }