diff options
author | HampusM <hampus@hampusmat.com> | 2022-05-08 23:04:16 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-05-08 23:05:36 +0200 |
commit | eddaed4e597ce2bc7fa179ce6a15b90951579c6e (patch) | |
tree | 0e696aaab4cb24f58582efce1982cce47832cb4f /minion/src/gymnasiearbete.cpp | |
parent | 2809f92eeb8b727e20167fe82e4cb9c3627d4870 (diff) |
feat(minion): implement respond to HTTP requests
Diffstat (limited to 'minion/src/gymnasiearbete.cpp')
-rw-r--r-- | minion/src/gymnasiearbete.cpp | 28 |
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); + } +} |