the invention disclosed is a path optimizer for peer to peer networks . large amounts of p2p file exchanges increase the costs to maintain a network . network service providers typically pay for the amount of data they exchange with other network service providers . the present invention examines p2p messages between and within networks and provides a cost efficient path to handle each p2p message .