Dear community
In an attempt to implement an LTE TCP client, I'm stuck at the problem, that `recv()` doesn't return after the server has closed the connection.
My test implementation does a simple http request (source code attached at the end of the message):
- Connect to a web server
- Send "GET / HTTP/1.0\r\n\r\n"
- Shutdown (SHUT_WR)
- Receive while return value of `recv()` > 0.
- Close
It does everything nicely except it never arrives at stage 5.
According to https://pubs.opengroup.org/onlinepubs/9699919799/functions/recv.html I would expect it to return '0' after the server has shut down the connection.
Any suggestions on what could be the problem here would be greatly appreciated!
Environment:
-- Zephyr version: 2.3.0-rc1
-- Board: nrf9160dk_nrf9160
-- West version: 0.7.2
-- DTC version: 1.4.7
-- Toolchain: gcc-arm-none-eabi-7-2018q2
Code used for testing:
Output:
*** Booting Zephyr OS build v2.3.0-rc1-ncs1 ***
+CEREG: 2,"9D08","013A2305",7,0,0,"11100000","11100000"
+CEREG: 5,"9D08","013A2305",7,,,"11100000","11100000"
--------- LTE CONNECTED ---------
--------- TCP CONNECTED ---------
--------- START RECEIVING ---------
HTTP/1.1 302 Moved Temporarily
Server: awselb/2.0
Date: Fri, 07 Aug 2020 17:31:50 GMT
Content-Type: text/html
Content-Length: 126
Connection: close
Location: prod-swagger-oss-1833484297.us-east-1.elb.amazonaws.com:443/
<html>
<head><title>302 Found</title></head>
<body bgcolor="white">
<center><h1>302 Found</h1></center>
</body>
</html>