Menu

dk-recv

Dirk Krause
← Previous ↑ Home → Next

dk-recv — Receive data stream from dk-send

Description

The program establishes a TCP connection to the given host and port and receives data. Output is written to the given file or standard output.


Examples

Distribute a file to one recipient

To distribute the file x.txt run the following command on the sender:

dk-send 9876 x.txt
Option / Argument Purpose
9876 TCP port number of your choice, your firewall must allow incoming connection requests to the port.
x.txt File name containing the data to send.

On the recipient run:

dk-recv sender 9876 x.txt
Option / Argument Purpose
sender Host name or IP address of sender host.
9876 Port number the sender is listening on for connection attempts.
x.txt Name of output file to write.

Clone hard disk partition (unknown filesystem) to multiple recipients

To clone the hard disk partition /dev/sda1 sector by sector to multiple recipients (same hardware, same partitioning) run on the sender:

dd if=/dev/sda1 | gzip -9 | dk-send 9876 -n unlimited -a 192.0.2.0/255.255.255.0
Program Option / Argument Purpose
dd Create data stream from storage device. As no output file is specified, output is written to standard output.
if=/dev/sda1 Name of storage device to create data stream from.
gzip -9 Compress data stream, use best compression.
dk-send Send data stream to one or multiple recipients running the dk-recv program.
9876 TCP port number to listen for incoming connection requests.
-n unlimited Do not specify a fixed number of recipients, final recipient has to use the -t option.
-a 192.0.2.0/255.255.255.0 Allow connection attempts only for specific hosts.

On the recipients except the final one, run:

dk-recv 192.0.2.2 9876 | gzip -dc | dk-blks -b 1M | dd of=/dev/sda1 bs=1M conv=fdatasync
Program Option / Argument Purpose
dk-recv Receive a data stream from a dk-send process.
192.0.2.2 Senders IP address (or host name).
9876 TCP port number the sender is listening on.
gzip -dc Uncompress data stream.
dk-blks -b 1M Create data stream of fixed block size 1 Mibibyte.
dd Apply data stream to storage device.
of=/dev/sda1 Name of storage device to write to.
bs=1M Read input and write to device in block size of 1 Mibibyte.
conv=fdatasync Synchronize device after writing.

On the final recipient run:

dk-recv 192.0.2.2 9876 -t | gzip -dc | dk-blks -b 1M | dd of=/dev/sda1 bs=1M conv=fdatasync
Program Option / Argument Purpose
dk-recv -t Notify sender to start transmission, no need to wait for other recipients to connect.

Clone hard disk partition (NTFS) to multiple recipients

To clone the hard disk partition /dev/sda1 containing an NTFS file system to multiple recipients (same hardware, same partitioning) run on the sender:

ntfsclone --save-image -o - /dev/sda1 | gzip -9 | dk-send 9876 -n unlimited -a 192.0.2.0/255.255.255.0
Program Option / Argument Purpose
ntfsclone Create image data from NTFS formatted partition.
--save-image Create image data stream containing used sectors only.
-o - Write output to standard output.
/dev/sda1 Partition to create stream.

On the recipients except the final one, run:

dk-recv 192.0.2.2 9876 | gzip -dc | ntfsclone --restore-image --overwrite /dev/sda1 -
Program Option / Argument Purpose
ntfsclone Apply image data stream.
--restore-image Process input image data stream containing used sectors only.
--overwrite Overwrite existing file/partition.
/dev/sda1 Destination storage device (partition to write).
- Data stream is processed from standard input.

On the final recipient run:

dk-recv 192.0.2.2 9876 -t | gzip -dc | ntfsclone --restore-image --overwrite /dev/sda1 -

Manual

See the [dk-recv manual] for the full documentation of the program.


← Previous ↑ Home → Next

Related

Wiki: Home
Wiki: Usage Examples
Wiki: dk-blks manual
Wiki: dk-recv manual

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.