Putting Multicast into Practice
The source files for this article include an Open Source program, ImageCaster, that shows how you can create a custom header. This program blasts out large files (such as ISO CD-ROM images) to all receivers. It has several fields in the header: ID, size of the message, offset into the file, a checksum of the entire message, and a message digest of the data.
The program breaks a file into parts and transmits it to a destination piece by piece. The destination can be either a peer or a multicast address. The receiver subscribes, if necessary, to a multicast address, and accepts each block of data. It disassembles the message and verifies data integrity. If all goes well, the receiver places the data in a file at the specified offset.
You can see the usefulness of this program, for example, if you have ever tried to download an ISO CD-ROM image file—only 650MB! You tune the program to send a message (up to 64KB) every second. It may take longer on some systems, but the program almost ensures that you can get up to 64 kilobytes/second. Naturally, you can change the code to send faster bit-rates.