Patent ID: 8505098

Claim:
A method for recording and recovering real traffic, used for processing a plurality of network packets of a plurality of network connections, comprising: executing a recording procedure, comprising: receiving a recording parameter (N, M, P), wherein N, M, and P are integers greater than or equal to one; completely recording a header and a payload of each network packet of the plurality of network connections, and accumulating a payload accumulation value of each network connection starting from the first network packet in each network connection and ending at the last network packet in each network connection; recording the header of each network packet and first M bytes of the payload of P consecutive network packets of the network connection corresponding to the payload accumulation value when one of the payload accumulation values exceeds N; and recording the header of the network packets of the network connection corresponding to the payload accumulation value when one of the payload accumulation values exceeds N and after recording the P consecutive network packets of the network connection corresponding to the payload accumulation value; and executing a recovery procedure, comprising: determining whether the headers and the payloads of the network packets are complete or not; determining whether the incomplete network packet has the complete header or not when obtaining at least one incomplete network packet; and executing following steps when the incomplete network packet has the complete header: obtaining a payload length of the incomplete network packet according to the header of the incomplete network packet; and writing a dummy value as the payload of the incomplete network packet according to the payload length.