Пример #1
0
        public ProtoProxyClient(ProtoProxyHost host, string key, ProtoClient client)
        {
            Require.NotNull(host, "host");
            Require.NotNull(key, "key");
            Require.NotNull(client, "client");

            _host = host;
            Key = key;
            Client = client;

            _lastInteraction = DateTime.Now;
        }
Пример #2
0
        public string CreateClient(int protocolVersion)
        {
            string key = RandomKeyGenerator.GetRandomKey(12);

            var configuration = BuildConfiguration();

            configuration.CallbackObject = new CallbackChannel(this, key);

            var client = new ProtoClient(_hostname, _hostPort, configuration, protocolVersion);

            lock (_syncRoot)
            {
                _clients.Add(key, new ProtoProxyClient(this, key, client));
            }

            return key;
        }