Skip to content

SendFile

David Anderson edited this page Aug 22, 2023 · 3 revisions

Sending files

To send a file to a specific host, use the function

send_file(int host_id, const char* file_name);

or the command line program (run from the project root directory)

send_file -host_id X -file_name Y

send_file creates a result and initializes it with a name of the form send_FILENAME_HOSTID_TIME.

A message is created for the host and added to the msg_to_host table. This message instructs the client to download the file and acknowledge a successful download. The download message included in the next RPC reply to the host. The message has the form:

<app>
	<name>FILE_MOVER</name>
</app>
<app_version>
	<app_name>FILE_MOVER</app_name>
	<version_num>n</version_num>
</app_version>
<result>
    <wu_name>x</wu_name>
    <name>y</name>
</result>
<file_info>
	<name>file_name</name>
	<url>download_dir/file_name</url>
	<md5_cksum>md5</md5_cksum>
	<nbytes>file->nbytes</nbytes>
	<sticky/>
</file_info>
<workunit>
	<name>result.name</name>
	<app_name>FILE_MOVER</app_name>
	<file_ref>
		<file_name>file_name</file_name>
	</file_ref>
</workunit>

For this to work, you need to include <msg_to_host/> in config.xml.

Clone this wiki locally