Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multicast support in .Net

Tags:

.net

multicast

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?

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.

like image 661
Mystic Avatar asked Feb 05 '09 11:02

Mystic


People also ask

Is multicast Layer 2 or Layer 3?

In most cases, multicast packets must pass through Layer 2 switching devices between multicast receivers and Layer 3 multicast routers. After a router forwards multicast packets to a switch, the switch forwards the multicast packets to multicast receivers.

What applications use multicast?

Examples on applications that use multicasting are video conferencing applications, applications that simultaneously transfer files to a group of receivers and radio and TV transmissions over the Internet.

What protocol does multicast use?

The most common transport layer protocol to use multicast addressing is User Datagram Protocol (UDP).

Does multicast use TCP or UDP?

Unicast uses TCP (Transmission Control Protocol) for communications while multicast communication uses UDP (User Datagram Protocol).


2 Answers

I was going to suggest that use callback channels (i.e. a pub/sub type system) implemented in WCF, but that would require your clients to register with the 'server'.

I was then going to mention enterprise class messaging solutions like Tibco EMS (a JMS implementation).

Then I hit google and found this link: WCF Multicasting. There are lots of ideas on there which I've not yet come across in my own inital look at WCF.

like image 99
ng5000 Avatar answered Sep 20 '22 11:09

ng5000


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.

See my answer here for more details.

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.

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

like image 34
Quassnoi Avatar answered Sep 18 '22 11:09

Quassnoi