use socket.makefile() for reading (thanks jercos!)
forgot to strip \r\n from end of line