Check out this project by @Kristopher which uses the web API instead of the telnet API for controlling Denon/Marantz receivers:
I made some really minor changes to the code to support my Marantz (NR-1602) receiver which Kristopher merged last night.