Having connection problems with #apple #homesharing? Research has shown, iTunes opens numerous connections when paired with an #appletv3 . As a workaround, a script was created to monitor those connections and to restart iTunes once it reaches a certain threshold.
I put the script together with a LaunchDaemon config into GitHub, for those in need for it. Hope it helps.
iTunesMonitor — Some AppleScript and LaunchDaemon config to monitor iTunes open connections