Add socket read timeout
Print error messages
Remove debugging output