Beispiel #1
0
        /// <summary>
        ///		构造函数, 不需要参数
        /// </summary>
        public RpcTcpClientChannel()
            : base("tcp")
        {
            RpcTcpBufferManager.Initialize();
            RpcTcpSimplexConnectionManager.Initialize();

            _simplexConnections = new Dictionary <ServerUri, RpcTcpSimplexConnection>();
            _duplexConnections  = new Dictionary <ServerUri, RpcTcpDuplexConnection>();

            p_channelSettings = new RpcChannelSettings()
            {
                MaxBodySize          = 512 * 1024 * 1024,
                SupportModes         = RpcChannelSupportModes.Connection | RpcChannelSupportModes.DuplexConnection,
                Version              = "4.3",
                Timeout              = RpcTcpBufferManager.Configuration.ChannelItem.Timeout,
                ConcurrentConnection = RpcTcpBufferManager.Configuration.ChannelItem.SimplexConnections,
            };

            RpcTcpTransactionManager.Initialize();
        }
Beispiel #2
0
        /// <summary>
        ///		构造函数
        /// </summary>
        /// <param name="port">tcp的监听端口</param>
        public RpcTcpServerChannel(int port)
            : base("tcp", "tcp://" + ServiceEnvironment.ComputerAddress + ":" + port)
        {
            RpcTcpBufferManager.Initialize();

            _port        = port;
            _socket      = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            _connections = new Dictionary <ServerUri, RpcTcpServerConnection>();

            p_channelSettings = new RpcChannelSettings()
            {
                MaxBodySize          = 512 * 1024 * 1024,
                SupportModes         = RpcChannelSupportModes.Connection | RpcChannelSupportModes.DuplexConnection,
                Version              = "4.3",
                Timeout              = RpcTcpBufferManager.Configuration.ChannelItem.Timeout,
                ConcurrentConnection = RpcTcpBufferManager.Configuration.ChannelItem.SimplexConnections,
            };

            _eAccept = RpcTcpBufferManager.FetchAcceptArgs();
            ((RpcTcpAsyncArgs)_eAccept).Callback = (e) => ProcessAccept(e);
        }