The actual telnetInterface is used to open the telnet connection. You then need a function (like you posted) to actually send data across the connection. Your return is to bring back the telnet response that will get parsed by the required parse function. The pause is to allow for the telnet connection to receive that response before moving on.