check for chars read, break when socket closes