The features of P2P networking architecture can contribute to robustness and scalability, however, it also introduces network-oblivious traffic, which brings big pressure to the ISPs. Meanwhile, since traffic of P2P applications occupies much of bandwidth in bottleneck links, non-p2p applications may be severely harmed due to lack of bandwidth. To conquer this problem, previous works mainly focused on blocking the P2P traffic to benefit the ISPs, or optimizing peer selection algorithms which can only benefit the P2P applications but ignore the influence to the network. In this paper, we propose an algorithm, which is called PSANIC, to optimize peer selection in P2P networks with consideration of not only network topology information but also node capability. Simulation results show that PSANIC can achieve better performance than traditional DHT algorithms and the algorithm proposed in our previous work in [10], it can also reduce traffic significantly between domains in networks.