P2p flow optimization method and system thereof

The invention relates to P2P flow optimization method and system thereof. The method comprises the following steps of: Step 1, obtaining network topology and network status, constructing overlay network based on the network topology, and initially requesting data by neighbor nodes of source nodes of application files; Step 2, coding the node-owned data after the nodes receive the requests, generating code blocks and global code coefficients, and packaging the code blocks and the global code coefficients and sending to the nodes which request data; Step 3, obtaining the global code coefficients after the nodes receive the requested packets, adding the global code coefficients to global code coefficient matrixes of the nodes, and sending the global code coefficient matrixes to the neighbor nodes; and Step 4, when the nodes request to obtain the data of the application files, selecting download points from the neighbor nodes based on the network status, the global code coefficient matrixes of the nodes and the global code coefficient matrixes of the neighbor nodes, and sending requests to the download points. The invention can reduce the data flow among networks and saves the bandwidth resources.