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.
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.
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.
The most common transport layer protocol to use multicast addressing is User Datagram Protocol (UDP).
Unicast uses TCP (Transmission Control Protocol) for communications while multicast communication uses UDP (User Datagram Protocol).
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With