Clear the timeout if data is received

Tied the timeout to a variable, the_timeout, and cleared the timeout in the recieve_data() function, because the timeout was going off regardless of receiving and response or not. 
An error would occur when the timeout function would try to socket.close() a closed socket.