wiki:NetworkApps

Apps that do network communication

Getting proxy info

If this host is using a proxy you must use that info. You can get it using get_init_data().

Honoring "don't use network" requests

The user may ask that network communication not be done based on time of day (user preferences) or the "Suspend Network" GUI command. When this is the case, BOINC_STATUS::network_suspended will be set in the status. You can get this using boinc_get_status().

Requesting network connection

If your application needs to do network communication and it appears that there is no physical network connection (e.g. gethostbyname() fails for a valid name) then:

  • Call boinc_need_network(). This will alert the user that a network connection is needed.
  • Periodically call boinc_network_poll() until it returns zero.
  • Do whatever communication is needed.
  • When done, call boinc_network_done(). This enables the hangup of a modem connection, if needed.
void boinc_need_network();
int boinc_network_poll();
void boinc_network_done();

Reporting network usage

If your app does significant network I/O, it should periodically call

void boinc_network_usage(double sent, double received);

This reports the cumulative number of bytes sent and received in the current run of the program (not since the beginning of the job).

If you don't call this, volunteers' "Transfer at more X MB per Y days" preferences will not be enforced properly.

Last modified 12 years ago Last modified on May 20, 2012, 4:10:40 PM