コード例 #1
0
        private void InitializeAndStartGrpcServer(int grpcPort, ServerServiceDefinition[] definitions, int requestCallTokensPerCompletionQueue)
        {
            Contract.Requires(definitions.Length != 0);
            GrpcEnvironment.InitializeIfNeeded();
            _grpcServer = new Server(GrpcEnvironment.DefaultConfiguration)
            {
                Ports = { new ServerPort(IPAddress.Any.ToString(), grpcPort, ServerCredentials.Insecure) },

                // need a higher number here to avoid throttling: 7000 worked for initial experiments.
                RequestCallTokensPerCompletionQueue = requestCallTokensPerCompletionQueue,
            };

            foreach (var definition in definitions)
            {
                _grpcServer.Services.Add(definition);
            }

            _grpcServer.Start();
        }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GrpcCopyClient" /> class.
 /// </summary>
 private GrpcCopyClient(Channel channel)
 {
     GrpcEnvironment.InitializeIfNeeded();
     _client = new ContentServer.ContentServerClient(channel);
 }
コード例 #3
0
ファイル: GrpcRepairClient.cs プロジェクト: kittinap/kunnjae
 /// <summary>
 /// Initializes a new instance of the <see cref="GrpcRepairClient" /> class.
 /// </summary>
 public GrpcRepairClient(uint grpcPort)
 {
     GrpcEnvironment.InitializeIfNeeded();
     _channel = new Channel(GrpcEnvironment.Localhost, (int)grpcPort, ChannelCredentials.Insecure);
     _client  = new ContentServer.ContentServerClient(_channel);
 }