Does your code hang or just timeout. You have a 10 second timeout. When your program does not respond, open the diagram and turn on execution highlighting, where is the code? Your while loop has a loop counter exit but closes the session after the first iteration. Lower the timeout, don't close the session on the first iteration, look at the characters that are returned to see if it indicates an error from the device.