コード例 #1
0
        public QpServerChannel(QpServer server, Stream stream, string channelName, CancellationToken cancellationToken, QpServerOptions options) : base(options)
        {
            this.server      = server;
            this.stream      = stream;
            this.ChannelName = channelName;
            this.options     = options;
            this.authedCommandExecuterManagerList = options.CommandExecuterManagerList;
            cts = new CancellationTokenSource();
            cancellationToken.Register(() => Stop());
            //修改缓存大小
            ChangeBufferSize(options.BufferSize);
            IsConnected = true;

            //初始化连接相关指令处理器
            var connectAndAuthCommandExecuterManager = new CommandExecuterManager();

            connectAndAuthCommandExecuterManager.Register(new Commands.Connect.Request(), connect);
            connectAndAuthCommandExecuterManager.Register(new Commands.Authenticate.Request(), authenticate);
            connectAndAuthCommandExecuterManager.Register(new Commands.HandShake.Request(), handShake);
            connectAndAuthCommandExecuterManager.Register(new Commands.GetQpInstructions.Request(), getQpInstructions);
            options.CommandExecuterManagerList = new List <CommandExecuterManager>()
            {
                connectAndAuthCommandExecuterManager
            };

            InitQpPackageHandler_Stream(stream);
            //开始读取其他数据包
            BeginReadPackage(cts.Token);
        }
コード例 #2
0
ファイル: QpServer.cs プロジェクト: aaasoft/Quick.Protocol
 public QpServer(QpServerOptions options)
 {
     options.Check();
     this.options = options;
 }