Is broadcasting via TCP possible?

随声附和 提交于 2019-11-28 10:52:40

As everyone has said that is not possible with TCP, it is unicast only. However there are implementations of reliable multicast, which should give you multicast with the reliability of TCP. See wikipedia, especially Pragmatic General Multicast.

No, there isn't. For example, the concept of window size and how it's adjusted becomes completely meaningless if you're trying to talk to multiple parties.

It might be possible to create a new protocol that shared many of the attributes of TCP while allowing multicast. But I think it would be highly problematic. For example, the speed at which recipients received data would be constrained by the limitations of the slowest receiver. The sender has to manage buffer space so that even the slowest receiver can get re-transmissions if necessary.

No, I think protocols for doing multicast are always going to have to be very special purpose and focused on the exact problem at hand. Something generalized and TCP-like just isn't feasible.

There are ways to do reliable multicast bulk data transfer. The basic idea is to use erasure codes to continuously transmit information in a sort of loop. Then a recipient can just start receiving packets until they have enough to reconstruct the original file.

But these don't seem to fit your scenario all that well.

Consider looking at overlay networks, or simply using a messaging middleware that provides publish semantics such as ØMQ which also conveniently provides a BSD socket API.

Your SendToAll() will need to iterate through all open sockets and write the data to each one independently.

Broadcast and multicast are limited to UDP sockets only.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!