In order to solve the problem that emerging and encrypted P2P protocols cannot be classified by traditional methods, a new efficient P2P identification algorithm based on the flow statistical characteristics was proposed. The concept of network protocol feature vector was defined at first, and then the feature subclass was selected using the neighbor distance and genetic algorithm. Due to the role of different attributes, the concept of network protocol feature weighting was proposed and calculated by particle swarm optimization. In order to improve the identification rate, the corresponding feature space was established respectively for TCP and UDP protocols. Experimental results showed that this method could effectively select the subclass from multiple attributes that could most reflect the difference among P2P protocols and also between P2P and non-P2P protocols. The identification rate was improved by feature weighting calculated by particle swarm optimization. In this algorithm, the identification rate of popular P2P protocols reached to 96%.