Though getline() function gets one line at a time, I believe that it will wait until the write end of the socket is closed and read end is ready. Socket here I mean of the device.
But if device does not close the write end and does not open the read end, say bcos the device goes down just before it tries to close the write end, then will this piece of code keep waiting, since it has already established connection to it and is waiting for reading from the read end of the socket of the device???