Updated to minimize code, add clarity, print out request in addition to response, and act as a better example for embedded coders to reference.
Note that changed to building up a big string of characters to send over socket instead of line by line so it can be printed out with more clarity and less code bloating.