惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

N
News and Events Feed by Topic
V
V2EX
博客园 - 【当耐特】
Vercel News
Vercel News
雷峰网
雷峰网
爱范儿
爱范儿
WordPress大学
WordPress大学
云风的 BLOG
云风的 BLOG
S
Securelist
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Microsoft Azure Blog
Microsoft Azure Blog
F
Full Disclosure
有赞技术团队
有赞技术团队
Hugging Face - Blog
Hugging Face - Blog
NISL@THU
NISL@THU
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Attack and Defense Labs
Attack and Defense Labs
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
Microsoft Security Blog
Microsoft Security Blog
腾讯CDC
P
Proofpoint News Feed
B
Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
K
Kaspersky official blog
I
InfoQ
Google Online Security Blog
Google Online Security Blog
L
LINUX DO - 最新话题
Project Zero
Project Zero
Engineering at Meta
Engineering at Meta
V
Visual Studio Blog
AI
AI
Schneier on Security
Schneier on Security
B
Blog RSS Feed
T
Tor Project blog
H
Help Net Security
H
Hackread – Cybersecurity News, Data Breaches, AI and More
L
LINUX DO - 热门话题
阮一峰的网络日志
阮一峰的网络日志
S
Security @ Cisco Blogs
T
Threat Research - Cisco Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
C
Cyber Attacks, Cyber Crime and Cyber Security
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
V2EX - 技术
V2EX - 技术
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
A
Arctic Wolf
Webroot Blog
Webroot Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main

博客园 - 大坏蛋

struts 2.1配置 腾讯,你是怎么知道我机器上装了360的 程序.NET Framework版本升级,重签名,重链接,批量签名工具 .NET 平台优秀控件及源代码介绍(一) 灯神 终于轻松下来了 如何扮演另一个帐号(C#实现) Friend Assemblies(.NET FrameWork 2.0新特性) 我的GMAIL开始使用 关于委派的返回值 .NET Remoting中的事件处理(.NET Framework 2.0) 关于MyIE2中博客园页面自动跳转的问题回答 Thread.Abort终止一个线程 今天统计了一下我们项目的代码 Friend Assembly 忘记交手机费,招商银行的自助缴费不错! 六一快到了,祝所有小朋友节日快乐 COM+连接池的问题 系统消息框居然是可以复制的
.NET Remoting的新特性-IpcChannel(.NET Framework 2.0)
大坏蛋 · 2004-09-10 · via 博客园 - 大坏蛋

.NET FrameWoek2.0中,新添加一个IpcChannel,它是利用Windows的Ipc(进程间通讯)实现的一个Remoting的Channel,它的速度比Http或Tcp的Channel快很多,但它只能被用在本机不同应用程序域之间的通讯,所以,如果我们的客户端有可能与服务器端在同一个机器上运行时,可以通过注册IcpChannel来提高性能。
下面是一个简单的IpcChannel的示例:

Using directives

namespace TestIpcChannel
{
    
class Program
    
{
        
static void Main(string[] args)
        
{
            IpcChannel myChannel 
= new IpcChannel("test");
            ChannelServices.RegisterChannel(myChannel);
            RemotingConfiguration.RegisterWellKnownServiceType(
typeof(RemObject), "RemObject.rem", WellKnownObjectMode.SingleCall);
            
//服务注册结束,下面是客户端代码
            RemObject obj = (RemObject)(Activator.GetObject(typeof(RemObject), "Ipc://Test/RemObject.rem"));
            obj.TestMethod();
            Console.ReadLine();
        }

    }

    
public class RemObject : MarshalByRefObject
    
{
        
public void TestMethod()
        
{
            Console.WriteLine(
"Hello IcpChannel!");
        }

    }


}

为了便于大家读代码,该程序同时扮演服务器和客户端的角色,可以直接编译执行。