Example #1
0
 /// <summary>
 /// 基础构造函数
 /// </summary>
 /// <param name="protocol">协议: 如"http"."tcp"</param>
 /// <param name="serverUri">监听的url,如tcp://192.168.1.100:8000/</param>
 protected RpcServerChannel(string protocol, string serverUri)
 {
     p_started         = false;
     p_protocol        = protocol;
     p_channelSettings = null;
     p_serverUri       = serverUri;
     p_syncRoot        = new object();
 }
Example #2
0
 public RpcHttpServerChannel(int port)
     : this(string.Format("http://*:{0}/", port))
 {
     p_channelSettings = new RpcChannelSettings()
     {
         MaxBodySize  = 512 * 1024 * 1024,
         SupportModes = RpcChannelSupportModes.None,
         Version      = "4.1",
     };
 }
Example #3
0
 public RpcPipeClientChannel()
     : base("pipe")
 {
     p_channelSettings = new RpcChannelSettings()
     {
         MaxBodySize  = 512 * 1024 * 1024,
         SupportModes = RpcChannelSupportModes.None,
         Version      = "4.1",
     };
 }
Example #4
0
 private RpcInprocClientChannel()
     : base("inproc")
 {
     p_channelSettings = new RpcChannelSettings()
     {
         MaxBodySize  = 512 * 1024 * 1024,
         SupportModes = RpcChannelSupportModes.None,
         Version      = "4.1",
     };
 }
Example #5
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();
        }
Example #6
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);
        }
Example #7
0
        public RpcPipeServerChannel(string pipeName, int instanceCount)
            : base("pipe", string.Format("pipe://.:{0}", pipeName))
        {
            _pipeName    = pipeName;
            _pipeServers = new NamedPipeServerStream[instanceCount];

            for (int i = 0; i < instanceCount; i++)
            {
                PipeSecurity security = new PipeSecurity();
                security.AddAccessRule(new PipeAccessRule(new NTAccount("Everyone"), PipeAccessRights.FullControl, AccessControlType.Allow));

                _pipeServers[i] = new NamedPipeServerStream(pipeName, PipeDirection.InOut,
                                                            instanceCount, PipeTransmissionMode.Byte, PipeOptions.Asynchronous, 0, 0,
                                                            security);
            }

            p_channelSettings = new RpcChannelSettings()
            {
                MaxBodySize  = 512 * 1024 * 1024,
                SupportModes = RpcChannelSupportModes.None,
                Version      = "4.1",
            };
        }