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

推荐订阅源

L
LINUX DO - 热门话题
Stack Overflow Blog
Stack Overflow Blog
B
Blog
WordPress大学
WordPress大学
Project Zero
Project Zero
P
Palo Alto Networks Blog
阮一峰的网络日志
阮一峰的网络日志
博客园 - 司徒正美
有赞技术团队
有赞技术团队
S
SegmentFault 最新的问题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
小众软件
小众软件
T
Tailwind CSS Blog
Forbes - Security
Forbes - Security
F
Full Disclosure
SecWiki News
SecWiki News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Hacker News: Ask HN
Hacker News: Ask HN
C
Check Point Blog
Microsoft Security Blog
Microsoft Security Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
F
Fortinet All Blogs
Cisco Talos Blog
Cisco Talos Blog
G
Google Developers Blog
J
Java Code Geeks
Google DeepMind News
Google DeepMind News
人人都是产品经理
人人都是产品经理
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Recorded Future
Recorded Future
O
OpenAI News
Spread Privacy
Spread Privacy
MongoDB | Blog
MongoDB | Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
C
Cybersecurity and Infrastructure Security Agency CISA
S
Securelist
V
Vulnerabilities – Threatpost
Y
Y Combinator Blog
IT之家
IT之家
U
Unit 42
腾讯CDC
S
Security Affairs
C
Cisco Blogs
Schneier on Security
Schneier on Security
The Last Watchdog
The Last Watchdog
B
Blog RSS Feed
宝玉的分享
宝玉的分享
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Security @ Cisco Blogs
Cyberwarzone
Cyberwarzone
T
The Blog of Author Tim Ferriss

博客园 - coollzh

关于.NET VS JavaEE平台争论的沉思录 不要使用Microsoft Project的理由 Using distributed transactions in .Net 1.x without deriving from ServicedComponent .NET下的开发者们正在继承计算机早期时代伟大的黑客精神 上海著名网络公司招聘高级软件工程师 即将过的2004 URLRewriting的问题 谁知道c++中的char ** 在C#中一般用什么类型 VC#2005 最新技术预览版下周发布 上海某著名互联网公司招聘asp.net/.net开发工程师 Coming soon: “Enterprise Library” .net framework1.1到2.0的重大变化 Windows 2003 中DTC的怪事情 动态Validator的奇怪问题 一件及其汗的事! sql server2000 在windows2003的默认安装客户端无法连接 msn”给你一个惊喜“的病毒 DataReader的问题 35岁前应该做好的十件事
Indigo Untyped Channel
coollzh · 2004-10-18 · via 博客园 - coollzh

有两种通道来使用最新的网络通讯组件Indigo:typeed 和untyped,typed channel是通过Server端的WSDL,即通过自动自动生成的interface,很明显,我们要遵守一个契约。另一个方面,我们可以使用untyped channel,在这个通道里,我们只是从一端到另一端传递最基本的Message(Indigo中的最基本单元),没有协议需要遵守,通常基于一个action URI.
看一个sample:

using System;

using System.MessageBus;

The client:

      class Client

      {

            [STAThread]

            static void Main(string[] args)

            {

Uri client = new Uri(String.Format("soap.tcp://{0}:6000/Client", System.Environment.MachineName));

Uri server = new Uri(String.Format("soap.tcp://{0}:6001/Server", System.Environment.MachineName));

                  Console.WriteLine("Client - {0}", client.ToString());

                  Uri action = new Uri("http://tempuri.org/action1");

                  Message message = new Message(action, "Hello");

                  message.Headers.Add(new PathHeader(server));

                  message.Headers.Add(new ToHeader(server));

                  message.Headers.Add(new ReplyInfoHeader(client));

                  Port port = new Port(client);

                  port.Open();

                  port.SendChannel.Send(message);

                  port.Close();

            }

      }

The Server:

      class Server

      {

            [STAThread]

            static void Main(string[] args)

            {

Uri server = new Uri(String.Format("soap.tcp://{0}:6001/Server", System.Environment.MachineName));

                  Port port = new Port(server);

                  ServerMessageHandler handler = new ServerMessageHandler();

                  port.ReceiveChannel.Handler = handler;

                  port.CloseTimeout = new TimeSpan(1, 0, 0, 0);

                  port.Open();

                  Console.WriteLine("Server - {0}", server.ToString());

                  Console.ReadLine();

            }

      }

      public class ServerMessageHandler : SyncMessageHandler

      {

            public override bool ProcessMessage(Message message)

            {

string content = message.Content.GetObject(typeof(string)) as string;

                  Console.WriteLine(content);

                  Console.ReadLine();

                  return true;     

            }

      }
看上去和remoting有点类似,其实编程方式更加简洁,更好理解。