Transferring Files
Letâs take a break from the lecturing and get back to our first love and the reason for doing all of this: code.
âHow do I send a file?â is a common question on the ÃMQ mailing lists. Not surprisingly, file transfer is perhaps the oldest and most obvious type of messaging. Sending files around networks has lots of use cases, apart from annoying the copyright cartels. ÃMQ is very good out of the box at sending events and tasks, but less good at sending files.
Iâve promised, for a year or two, to write a proper explanation. Hereâs a gratuitous piece of information to brighten your morning: the word âproperâ comes from the archaic French propre, which means âclean.â English common folk in the Dark Ages, not being familiar with hot water and soap, changed the word to mean âforeignâ or âupper-class,â as in âthatâs proper food!â; later it came to mean just âreal,â as in âthatâs a proper mess youâve gotten us into!â
So, file transfer. There are several reasons why you canât just pick up a random file, blindfold it, and shove it whole into a message. The most obvious reason is that despite decades of determined growth in RAM sizes (and who among us old-timers doesnât fondly remember saving up for that 1,024-byte memory extension card?!), disk sizes obstinately remain much larger. Even if we could send a file with one instruction (say, using a system call like sendfile), weâd hit the reality that networks are neither infinitely ...
Get ZeroMQ now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.