Implemented getting input from the connection and sending data back.