dns_gethostbyname(url.c_str(), &ipAddr, OtaUpdater::onUrlResolved, this);
Once the URL is resolved, I made a call to
rboot_ota_start(&inst->ota)
with the ota structure filled in with the resolved IP address, e.g.
// Create the update structure
memcpy(&inst->ota.ip, ip, sizeof(*ip));
inst->ota.port = inst->port;
inst->ota.callback = OtaUpdater::onFirmwareFetched;
inst->ota.user_arg = inst;
// Select rom slot to flash
slot = rboot_get_current_rom();
if (slot == 0) slot = 1; else slot = 0;
inst->ota.rom_slot = slot;
// Actual HTTP request
os_sprintf((char*)inst->ota.request,
"GET /%s HTTP/1.1\r\nHost: " IPSTR "\r\n" HTTP_HEADER,
(slot == 0 ? "rom0.bin" : "rom1.bin"),
IP2STR(inst->ota.ip));
debugf("OtaUpdater: HTTP request: %s\n", inst->ota.request);
// Start the upgrade process
if ( rboot_ota_start(&inst->ota) )
{
inst->status = OTA_STATUS_FETCHING_FIRMWARE;
debugf("Fetching firmware...\r\n");
}
Hope this helps . . .