Exemplo n.º 1
0
 public RSSSHConnector(RSRPC parent, string IP, ushort port, string user, string pw)
 {
     _parent = parent;
     _host   = IP;
     _port   = port;
     _user   = user;
     _pw     = pw;
 }
Exemplo n.º 2
0
        //public ushort ReadSpeed
        //{
        //    get { return _readSpeed; }
        //    set
        //    {
        //        _readSpeed = value;
        //        switch (_readSpeed)
        //        {
        //            case 0:
        //            default:
        //                break;
        //            case 10:
        //                _bufferLength = 512; _sleepTime = 50; // ~10KiB/s
        //                break;
        //            case 20:
        //                _bufferLength = 1024; _sleepTime = 50; // ~20KiB/s
        //                break;
        //            case 50:
        //                _bufferLength = 512; _sleepTime = 10; // ~50KiB/s
        //                break;
        //            case 100:
        //                _bufferLength = 512; _sleepTime = 5; // ~100KiB/s
        //                break;
        //            case 500:
        //                _bufferLength = 512; _sleepTime = 1; // ~500KiB/s
        //                break;
        //        }
        //    }
        //}

        public RSProtoBuf(ShellStream stream, Queue <RSProtoBuffSSHMsg> sendQueue, Queue <RSProtoBuffSSHMsg> receiveQueue, RSRPC parent, uint timeout = 1000, bool useThread = true)
        {
            _stream = stream;

            _nextReqID    = 1;
            _timeOut      = timeout;
            _sendQueue    = sendQueue;
            _receiveQueue = receiveQueue;
            _parent       = parent;

            if (useThread)
            {
                _run           = true;
                _finishQueue   = false;
                _findMagicCode = false;
                _t             = new Thread(new ThreadStart(mainLoop));
                _t.Priority    = ThreadPriority.AboveNormal;
                _t.Name        = "RS Send/Recieve loop";
                _t.Start();
            }
        }