English 中文(简体)
.NET Alternatives to UDP Multicast
原标题:

I am looking for an alternative to using UDP multicast on the .NET Framework and am looking for suggestions.

I need to send messages to several web servers running quite a few ASP.NET applications. These messages would be one-way only, coming from several different machines. UDP multicast would be perfect except that I can t use it due to it requiring administrative rights. See ASP.NET Multicast UdpClient problems for details as to why.

Is there something else that would work in a similar manner, allowing multiple applications to receive broadcast-type messages?

问题回答

Have you considered using MSMQ or a SQL database? Using a SQL 2008 database you can have the SQL server notify you of changes as well.

A few possibilities come to mind:

  1. Put your multicast UDP code into a Windows Service. By having only a single listener on the port, you wouldn t need elevated permissions. You could communicate with the service using shared memory or a number of other techniques.

  2. Use async point-to-point raw TCP connections to a central message dispatch / relay node. Sending and receiving messages with async I/O would minimize wait time.

  3. Use a persistent queuing mechanism such as Service Broker in SQL Server. It s still unicast, but you could have a single stored procedure that sent messages to all endpoints. Again, use async I/O to minimize wait times.

  4. Use a commercial message passing bus that runs out of process -- something like Tibco Rendezvous.

ØMQ has two CLR bindings that may be productive than rolling your own messaging layer. You can use PUB/SUB sockets to multicast messages over TCP or IP multicast as desired. Also as the library is external to ASP.net this should remove the restricted rights problem you are encountering.

ActiveMQ is a free service like msmq. It can handle non-durable messages such as yours. The downside is that is that it requires a server because it s bascially as spoke and hub style approach where you have a central server. But it does work well in .NET and has great performance. I m sending hundreds of messages across it per second and it keeps up just fine.

Redis pubsub using the StackExchange.Redis API.

Simple, excellent performance, scalable and if you choose it you re bound to use it for other things like caching/session management/monitoring or any one of the other common uses of this swiss army knife toolkit.





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签