Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Broadcast like UDP with the reliability of TCP

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 hear it and act accordingly. Is there a way that we can broadcast out messages like this (like UDP will let you do) while keeping guaranteed delivery (like TCP)?

This is on a small network (30ish clients), if that would make a difference.

like image 875
Jeffrey Avatar asked Aug 28 '08 02:08

Jeffrey


People also ask

Is TCP and UDP are reliable?

TCP is more reliable than UDP. UDP is faster for data sending than TCP. UDP makes error checking but no reporting but TCP makes checks for errors and reporting. TCP gives a guarantee that the order of data at receiving end is the same as on sending end while UDP has no such guarantee.

How TCP achieves reliability over UDP?

Unlike UDP, TCP provides reliable message delivery. TCP ensures that data is not damaged, lost, duplicated, or delivered out of order to a receiving process. This assurance of transport reliability keeps applications programmers from having to build communications safeguards into their software.

Is broadcast UDP or TCP?

TCP doesn't support Broadcasting. UDP supports Broadcasting. TCP is used by HTTP, HTTPs, FTP, SMTP and Telnet. UDP is used by DNS, DHCP, TFTP, SNMP, RIP, and VoIP.

What are TCP and UDP which is reliable and which is not?

TCP is suited for applications that require high reliability, and transmission time is relatively less critical. UDP is suitable for applications that need fast, efficient transmission, such as games. UDP's stateless nature is also useful for servers that answer small queries from huge numbers of clients.


3 Answers

Almost all games have a need for the fast-reacting properties (and to a lesser extent, the connectionless properties) of UDP and the reliability of TCP. What they do is they build their own reliable protocol on top of UDP. This gives them the ability to just burst packets to whereever and optionally make them reliable, as well.

The reliable packet system is usually a simple retry-until-acknowledged system simpler than TCP but there are protocols which go way beyond what TCP can offer.

Your situation sounds very simple. You'll probably be able to make the cleanest solution yourself - just make every client send back an "I heard you" response and have the server keep trying until it gets it (or gives up).

If you want something more, most custom protocol libraries are in C++, so I am not sure how much use they'll be to you. However, my knowledge here is a few years old - perhaps some protocols have been ported over by now. Hmm... RakNet and enet are two C/C++ libraries that come to mind.

like image 68
Sander Avatar answered Oct 11 '22 12:10

Sander


Take a look at sctp which has a combination of tcp and udp features. There is a windows implementation available.

like image 34
epatel Avatar answered Oct 11 '22 14:10

epatel


You could use Spread to do group communication.

like image 40
Cagatay Avatar answered Oct 11 '22 14:10

Cagatay