I\'m working on a .net solution that is run completely inside a single network. When users make a change to the system, I want to launch an announcement and have everyone else h
You'd definitely want to look into Pragmatic General Multicast:
While TCP uses ACKs to acknowledge groups of packets sent (something that would be uneconomical over multicast), PGM uses the concept of Negative Acknowledgements (NAKs).
For further G-diving, the term you're looking for is reliable multicast. Also take a look at Multipath TCP.
I think there are three options, broadly speaking:
Create a TCP server. Have each client connect. In your TCP protocol with the clients, create each packet with a 2-byte prefix of the total size of the following message.
Clients then call read(max_size=2)
on the socket to determine the size of the next message, and then read(max_size=s)
to collect the message.
You get reliable, ordered messages, simple. You don't need a messaging framework for this one.
Why build something from scratch if you can use library? Especially for such small project?
Try use Emcaster which itself using reliable multicast messaging - PGM, is written in .NET and with full source. You will get nice pub/sub engine with topic filtering readily available. Or you can learn from code how to do it and base your own extension on it.
I think the most irritating feature of TCP in these scenarios is the ability/way of sorting incoming packets to their original order - the concept of a stream. You cannot read a byte until the byte before it arrived.
If you can live without it, you have your chance to have your protocol, fast and reliable, but not for ordering of packets! It's simply impossible to manage both of them, because you cannot order your bytes until you receive an other copy of a lost packet, that's the main tradeoff.
You might want to look into RFC 3208 "PGM Reliable Transport Protocol Specification".
Here is the abstract:
Pragmatic General Multicast (PGM) is a reliable multicast transport
protocol for applications that require ordered or unordered,
duplicate-free, multicast data delivery from multiple sources to
multiple receivers. PGM guarantees that a receiver in the group either receives all data packets from transmissions and repairs, or is able to detect unrecoverable data packet loss. PGM is specifically intended as a workable solution for multicast applications with basic reliability requirements. Its central design goal is simplicity of operation with due regard for scalability and network efficiency.