Wi-Fi Fundamentals Lesson 6, Exercise 1 missing `close(sock)

If you run the exercise 1 code as-is (with the lines from the course materials added) it will run out of sockets and fail within a few button 2 presses.  The problem is that the sockets are never closed, yet every button press tried to open an new one.

In the solution code, the socket is properly closed at the bottom of these three functions.  The `close(sock);` lines should be added to the base code for the exercise as well, or else the student version will run out of sockets.

  • client_http_put()
  • client_http_get()
  • client_get_new_id()

Each of these should end with:

close(sock);
return err;

Related