CPC H04L 61/2517 (2013.01) [H04L 2101/695 (2022.05)] | 20 Claims |
1. A method of sending data, applied to a terminal device associated with symmetric network address translation (NAT), the method comprising:
establishing a queue for accommodating m file descriptors for generating n1 first access request data packets to be sent from the terminal device, wherein 2≤m<n1;
creating an ith file descriptor in the queue, generating and sending an ith first access request data packet by using the ith file descriptor, and monitoring a source port recorded by the ith file descriptor, wherein the ith file descriptor corresponds to a same source port as the ith first access request data packet, and 1≤i≤n1;
at every first preset time interval t1, enabling i to automatically increase by 1, continuing to perform operations of creating an (i+1)th file descriptor in the queue, generating and sending an (i+1)th first access request data packet by using the (i+1)th file descriptor, and monitoring a source port recorded by the (i+1)th file descriptor, and setting a preset monitoring time T for each source port, wherein each file descriptor records a different source port, and T=t1*m;
ending monitoring of an (i-m)th source port and destroying a corresponding file descriptor while creating a file descriptor in the queue when m*j<i≤m*(j+1), wherein j≥1; and
stopping monitoring other source ports in response to detecting that a first port of the terminal device receives a response data packet, and wherein the first port is any source port in a monitored state.
|