merging some rpcclient and net functionality from HEAD