2004年10月18日

Indigo Untyped Channel

有两种通道来使用最新的网络通讯组件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有点类似,其实编程方式更加简洁,更好理解。

posted @ 2004-10-18 23:38 coollzh 阅读(1285) 评论(1) 编辑

VC#2005 最新技术预览版下周发布

来自Somasegar's WebLog的消息,微软下周将发布最新技术预览版的Visual Studio 2005,该版最激动人心的功能是VC#也支持Edit & Continue’ (E&C). 了,说可以显著提高C#开发人员的开发条是效率
最新消息请参考http://msdn.microsoft.com/vs2005/
 

posted @ 2004-10-18 22:50 coollzh 阅读(1234) 评论(0) 编辑

上海某著名互联网公司招聘asp.net/.net开发工程师

敝公司是国内著名互联网企业,总部在上海,因业务需要招聘ASP.NET/.NET开发人员
特邀博客园中富有创新精神,有激情的同道中人加盟

要求:
熟悉NET Framework,C#
熟悉asp.net编程模型
熟悉多层次开发模式
熟悉SQL Server,Oracle

可发信 coollzh@etang.com

已征的dudu老大同意放首页一会,再次感谢!

posted @ 2004-10-18 13:51 coollzh 阅读(2928) 评论(18) 编辑