在网上看到(包括MSDN中)关于自定义压缩信道的配置方式都是使用*.config配置文件的方式,可以是我的框架中是自定义的配置文件,编程实现Remoting的配置,要编程配置自定义信道方法如下:

服务端:

Remoting压缩信道的编程配置方式                //建立一个端口键值对。名称,端口号。
Remoting压缩信道的编程配置方式
                IDictionary props = new Hashtable();
Remoting压缩信道的编程配置方式                props[
"name"= serviceName;
Remoting压缩信道的编程配置方式                props[
"port"= channelPort;        
Remoting压缩信道的编程配置方式
Remoting压缩信道的编程配置方式                
//为使用 压缩接收器 的服务器格式化程序信道接收器提供程序提供实现。
Remoting压缩信道的编程配置方式
                JCsoft.Common.Remoting.Channels.CompressionServerFormatterSinkProvider serverSinkProvider = new JCsoft.Common.Remoting.Channels.CompressionServerFormatterSinkProvider(compressionLevel);
Remoting压缩信道的编程配置方式                
Remoting压缩信道的编程配置方式                
//注册信道。
Remoting压缩信道的编程配置方式
                switch(channelType)
;


客户端:
Remoting压缩信道的编程配置方式            object service = null;
Remoting压缩信道的编程配置方式            
string machine = "localhost";
Remoting压缩信道的编程配置方式            
string connectionString = string.Empty;
Remoting压缩信道的编程配置方式
Remoting压缩信道的编程配置方式            
//为使用 压缩接收器 的服务器格式化程序信道接收器提供程序提供实现。
Remoting压缩信道的编程配置方式
            JCsoft.Common.Remoting.Channels.CompressionClientFormatterSinkProvider clientSinkProvider = new JCsoft.Common.Remoting.Channels.CompressionClientFormatterSinkProvider(compressionLevel);
Remoting压缩信道的编程配置方式
//            JCsoft.Common.Remoting.Channels.CompressionClientFormatterSink clientSink = new JCsoft.Common.Remoting.Channels.CompressionClientFormatterSink(compressionLevel);
Remoting压缩信道的编程配置方式                
Remoting压缩信道的编程配置方式            
//注册信道。
Remoting压缩信道的编程配置方式
            switch(channelType)
            }

代码中部分注释掉的是错误的。

如何实现压缩信道可以参见博客园-Zendy实现一个压缩Remoting传输数据的Sink:CompressionSink 的一篇文件http://www.cnblogs.com/caomao/archive/2005/07/29/202942.aspx,当然也可以自已看MSDN来学习Remoting压缩信道的编程配置方式

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-11
  • 2022-01-19
  • 2021-07-08
  • 2022-02-01
  • 2021-11-03
猜你喜欢
  • 2021-10-09
  • 2021-10-16
  • 2021-11-04
  • 2021-07-26
  • 2022-03-10
  • 2022-12-23
相关资源
相似解决方案