开发者

.NET Alternatives to UDP Multicast

开发者 https://www.devze.com 2022-12-15 23:34 出处:网络
I am looking for an alternative to using UDP multicast on the .NET Framework and am looking for suggestions.

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

I need to se开发者_运维百科nd 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号