Added receive direction

Added receive direction, switch receive code to line buffered reader.