summaryrefslogtreecommitdiff
path: root/minion/src/gymnasiearbete.cpp
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-05-08 23:04:16 +0200
committerHampusM <hampus@hampusmat.com>2022-05-08 23:05:36 +0200
commiteddaed4e597ce2bc7fa179ce6a15b90951579c6e (patch)
tree0e696aaab4cb24f58582efce1982cce47832cb4f /minion/src/gymnasiearbete.cpp
parent2809f92eeb8b727e20167fe82e4cb9c3627d4870 (diff)
feat(minion): implement respond to HTTP requests
Diffstat (limited to 'minion/src/gymnasiearbete.cpp')
-rw-r--r--minion/src/gymnasiearbete.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/minion/src/gymnasiearbete.cpp b/minion/src/gymnasiearbete.cpp
index 0e1adb5..b3c543a 100644
--- a/minion/src/gymnasiearbete.cpp
+++ b/minion/src/gymnasiearbete.cpp
@@ -64,6 +64,32 @@ void setup()
Serial.print("IP address: ");
Serial.println(wifi_module.get_local_ip(local_ip));
+
+ wifi_module.set_multiple_connections_enabled(true);
+
+ delay(1000);
+
+ wifi_module.create_tcp_server(80U);
}
-void loop() {}
+void loop()
+{
+ if (wifi_module.has_incoming_request())
+ {
+ char raw_request[200] = "";
+
+ const auto connection_id = wifi_module.read_incoming_request(raw_request);
+
+ Serial.print("Connection ID: ");
+ Serial.println(connection_id);
+
+ Serial.print("\nRaw request: ");
+ Serial.println(raw_request);
+
+ wifi_module.send(connection_id, "lmao!");
+
+ wifi_module.close_connection(connection_id);
+
+ delay(1000);
+ }
+}