I had been having all sorts of home sharing problems of the remote app not finding the appletv2, appletv2 not loading the itunes library, Airplay functionality dropping etc. I have a late 2009 Mac Mini, an Iphone 4 and an Ipod Touch 2G. All worked well until all the library sharing was moved to Homesharing rather than shared libraries in the recent IOS releases. I found that if I rebooted my D Link DSL 2740R router then everything would work again.
It was down to DHCP lease renewal of IOS devices. It seems that sleeping IOS devices do not allow the router to reassign their IP address when the lease expires.
If you log on to your router and look for connected clients then various IOS devices would still be connected even though they were asleep and eventually the router would have trouble with the multicast packets (bonjour) for Airplay and Homesharing as there would be no response from 'connected' clients.
I found this article on the Princeton University site.
http://www.net.princeton.edu/apple-ios/ios41-allows-lease-to-expire-keeps-using- IP-address.html
You need to switch off Notifications, Push email and Facetime and Find my Iphone to remove the behaviour. The article is worth reading as it narrows down the issue.
Hope this helps. (until Apple work on the bug and allow the use of advertised functionality to their devices)