[En-Nut-Discussion] Basics of output to HTTP
Harald Kipp
harald.kipp at egnite.de
Tue Mar 19 09:32:42 CET 2013
Hi Zehro,
On 15.03.2013 18:03, Zehro Lai wrote:
> Hello,
>
> I have a very basic beginner's question regarding the relationship
between the C code and what I choose to present on a web page. As far as
I've understood, the 'puts' outputs/prints data of a chosen kind to the
terminal window through which I've connected to the Ethernut. I've tried
some of the examples from the wiki, and these work fine in that sense
(except that the NTP server example keeps failing to retrieve time, for
some reason...). Now, I'd like the data -- for instance the clock in the
NTP case -- to be presented in my browser when accessing the device.
>
> What is the easiest way of accomplishing this? Or are there some
specific examples that do this I could try looking through (haven't
found any myself).
>
> I apologize if this is the wrong forum for these kind of questions.
In a way this _is_ the right forum _and_ it _is_ _not_ the right forum. :-)
What is the easiest way depends on your preference. Nut/OS allows to use
page refresh, CGI, SSI, Java, JavaScript, Ajax (with XML or JSON)...
just to name a few.
Here is a simple example that uses Ajax to display the current time:
http://ethernut.svn.sourceforge.net/viewvc/ethernut/trunk/nut/app/uhttpd_ajax/httpd_ajax.c
For the NTP server, you should use the pool of your region
http://www.pool.ntp.org/en/
As IP addresses may change from time to time, better use the NTP pool's
host names and
http://www.ethernut.de/nutwiki/Domain_Name_Service
to resolve them.
Regards,
Harald
More information about the En-Nut-Discussion
mailing list