Exemple #1
0
        public static async Task <NodeRegionServer> Connect(string host, ushort rpcPort, ushort tcpPort)
        {
            // RPC
            var options = new List <ChannelOption>();

            options.Add(new ChannelOption(ChannelOptions.MaxMessageLength, 65536 /* needs to match server */));
            Channel channel = new Channel(host, rpcPort, ChannelCredentials.Insecure, options);
            await channel.ConnectAsync(DateTime.UtcNow.AddSeconds(20));

            // TCP
            TcpRelaySocket sock = new TcpRelaySocket(host, tcpPort);

            var server = new NodeRegionServer(channel, new RegionService.RegionServiceClient(channel), sock);
            await server.Init();

            return(server);
        }
Exemple #2
0
 private NodeRegionServer(Channel chan, RegionService.RegionServiceClient clt, TcpRelaySocket socket)
 {
     channel        = chan;
     rpc            = clt;
     tcpRelaySocket = socket;
 }