Tags:
view all tags
---+ A WEB Server and the HTTP Protocol ---++ Exercise 1: Write a Hello World WEB Server Write a simplistic WEB server, serving a single WEB page. This server is very similar to the TCP server written in the [WiFi]] exercises. It now waits for a connection on port 80, reads a request from the browser, and sends a simple HTML page as its response. Interpretation of the incoming request is not necessary because the server is only capable of sending a single page anyway. Print the incoming HTTP request, which will look similar to this: <img alt="http.png" height="602" src="%ATTACHURL%/http.png" title="http.png" width="737" /> The request starts with "Content Get / HTTP/1.1" The page seen by the browser will look similar to this: <img alt="helloWorldWebServerV1.png" height="210" src="%ATTACHURL%/helloWorldWebServerV1.png" title="helloWorldWebServerV1.png" width="925" /> ---++ Exercise 2: Provide Measurement Data on the WEB Page Modify the WEB server to provide temperature and humidity measured with the SHT30. The easiest way to accomplish this is static text like in the Hello World HTML page into which the measurements can be inserted. This can be done with _[[https://github.com/pfalcon/utemplate][utemplates]]_, which are provided by _[[https://github.com/pfalcon/picoweb][picoweb]]_. Have a look in the _utemplates_ README.MD and in the examples directory of picoweb to understand how this is implemented. This is how your WEB site for SHT30 measurements might look like (screen dump of the solution script): <img alt="sht30WebSite.png" height="254" src="%ATTACHURL%/sht30WebSite.png" title="sht30WebSite.png" width="587" /> ---++ Exercise 3: Ajax The above exercise has a major flaw: For each measurement you must reload the entire page. It would be much nicer it the WEB page could be updated whenever a new is requested. -- %USERSIG{UliRaich - 2020-05-27}% ---++ Comments %COMMENT%
Attachments
Attachments
Topic attachments
I
Attachment
History
Action
Size
Date
Who
Comment
png
helloWorldWebServerV1.png
r1
manage
38.8 K
2022-10-03 - 08:22
UliRaich
png
http.png
r1
manage
105.1 K
2022-10-03 - 08:17
UliRaich
png
sht30WebSite.png
r1
manage
15.5 K
2020-05-27 - 19:53
UliRaich
Edit
|
Attach
|
Watch
|
P
rint version
|
H
istory
:
r11
|
r8
<
r7
<
r6
<
r5
|
B
acklinks
|
V
iew topic
|
Raw edit
|
More topic actions...
Topic revision: r6 - 2022-10-03
-
UliRaich
Home
Site map
AFNOG web
Embedded_Systems web
IoT_Course_English web
IoT_Course_French web
Main web
Sandbox web
TWiki web
IoT_Course_English Web
Create New Topic
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
P
View
Raw View
Print version
Find backlinks
History
More topic actions
Edit
Raw edit
Attach file or image
Edit topic preference settings
Set new parent
More topic actions
Account
Log In
Register User
Edit
Attach
Copyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback