Передача файлов

356
Shan-Desai

Мне любопытно, есть ли реализации, где можно отправить файл по широковещательному адресу, как в адресах IPv4, нескольким конечным хостам?

Например, можно scpвыполнить трансляцию файла на несколько хостов.

scp myFile.txt host@192.168.50.255:/home/hostname 

Очевидный способ сделать мгновенный scpна двух или более хостах является использование &&оператора, но что происходит, когда номера хостов больше 20+

0
Я думаю, что технически вы хотите сделать многоадресную рассылку, а не трансляцию. Richie086 8 лет назад 0
Многоадресная рассылка, безусловно, хороший вариант здесь, спасибо @MariusMatutiae Shan-Desai 8 лет назад 0

2 ответа на вопрос

1
MariusMatutiae

Yes it can be done. Jakuje is right that it cannot be done in TCP, however his reply does not cover UDP, which is instead used exactly for this.

I used for some time this Java program to do this, but then I discovered that Clonezilla can do it,

Multicast is supported in Clonezilla SE, which is suitable for massive clone

and this gave me the motivation to look into how they did it: the authors of Clonezilla themselves state they use UDPCast for this, and this is all: UDPCast's Web page states

UDPcast is a file transfer tool that can send data simultaneously to many destinations on a LAN. This can for instance be used to install entire classrooms of PC's at once. The advantage of UDPcast over using other methods (nfs, ftp, whatever) is that UDPcast uses UDP's multicast abilities: it won't take longer to install 15 machines than it would to install just 2.

It is in the repos for the distros I use (Debian, Kubuntu, Arch Linux), so I presume it will be in just about all repos.

0
Jakuje

No. It does not work like this. scp works over ssh protocol, which is connection-based (TCP) and therefore it can not do broadcast. It sends data and receives confirmation that the data were received correctly by the other side.

You could do that with significant modification of the client, that would open connection to more servers and would send data over to all of them, but it is not a real broadcast.