api: better compat with telnet + help command

handle "\r\n" and terminate connection if command is not known