Hi,
This shows how approachable network programming has become with the
recent IP65 update (together with cc65). Two examples...
To send an Email via a previosuly set up applet on
ifttt.com named
"email" you basically do the following:
{
// Presume the Ethernet card to reside in slot 3
ip65_init(3);
dhcp_init();
ifttt_trigger("My_Secret_IFTTT_Webhook_Key", "email",
"me.myself@and.i", "The Title", "The Body");
}
To set the ProDOS 8 date on every boot on a machine without RTC you do
the following as a SYS program located before BASIC.SYSTEM:
{
// Presume the Ethernet card to reside in slot 3
ip65_init(3);
dhcp_init();
time.tv_sec = sntp_get_time(dns_resolve("
pool.ntp.org"));
time.tv_nsec = 0;
// Convert time from seconds since 1900 to
// seconds since 1970 according to RFC 868
time.tv_sec -= 2208988800UL;
// Set the date in the ProDOS 8 gloal page
clock_settime(CLOCK_REALTIME, &time);
exec("BASIC.SYSTEM", NULL);
}
Have fun,
Oliver