在净多播支持 [英] Multicast support in .Net

查看:153
本文介绍了在净多播支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了实现使用多播发送小周期的消息到网络中其他进程的网络应用程序,我有关于使用API​​在.NET Framework有什么选择?除了我明显的电流选择,的System.Net.Sockets API,并WCF提供了一个更简单的方法?或者是WCF纯属点至点基于SOA的IPC机制?

In order to implement a network application that uses multicasts to send small periodic messages to other processes in the network, what choices do I have with regard to using APIs in the .Net framework? Apart from my obvious current choice, the System.net.sockets API, does WCF provide a simpler approach? Or is WCF purely a point-to-point SOA-based IPC mechanism?

注意:我很熟悉的多播节目的实施细节。我所感兴趣的听证会还有什么其他的选择.net框架的优惠。

Note: I'm quite conversant with the implementation details of multicast programming. What I am interested in hearing is what other choices the .Net framework offers.

推荐答案

您只需要创建一个 UDPClient 和发送数据到多播地址( 224 / 4 ,也就是从 224.0.0.0 239.255.255.255 )的地址。

You just create a UDPClient and send data to a multicast address (224/4, that is any address from 224.0.0.0 to 239.255.255.255).

您的客户只听这个地址和往常一样。

Your clients just listen on this address as usual.

请参阅我的回答<一href="http://stackoverflow.com/questions/506879/question-about-ip-multicasting/506894#506894">here了解更多详情。

See my answer here for more details.

P.S。虽然 WCF 是一个相当矫枉过正这样一个简单的任务,这是完全可能的 WCF 。有不同的消息交换模式在那里,我。即该方式的通信流。

P.S. Though WCF is quite an overkill for such a simple task, it's perfectly possible with WCF. There are different Message Exchange Patterns there, i. e. the ways the communication flows.

您需要的是 IOutputChannel 发件人和 IInputChannel 的监听器,这些都是数据报导向花纹。

What you need is IOutputChannel for the sender and IInputChannel for the listeners, these are datagram oriented patterns.

这篇关于在净多播支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆