## 3 Algorithm Design and Analysis
### TCP-SCTP Method
#### 3.3.3 Algorithm Design
If the packet loss rate of the current packet was greater than the packet loss rate recorded last time, the network condition was worse than that of the last time. * Line 14 was used to update the LastRate value for comparison with the packet loss rate next time. * Line 15 was used to update the value of Count, and the algorithm needed to add one to the value of Count. * Line 16 updated the value of DetectSlot. The network was getting worse, thus it set the value of DetectSlot to half the original value. * Line 17 indicates that the current packet loss rate was less than the last recorded packet loss rate. * The same Line 18 was used to update the LastRate value. * Line 19 was used to update the value of Count. The packet loss rate did not keep increasing, thus the algorithm needed to reset the value of Count to zero. * Line 20 was used to update the value of DetectSlot. The algorithm determined that the network condition was getting better, thus it did not need to frequently detect the trend of the network condition. It set the value of DetectSlot to twice the original value. * After obtaining the new packet loss rate every time, Line 23 started to judge whether or not the packet loss rate kept increasing for three times through the value of Count. If the packet loss rate kept increasing for three times, it was considered that the network condition kept getting worse. * Line 24 shows the algorithm calling the MS-SCTP method or the TCP-SCTP switch process. * Line 25 indicates that the Count value was reset to zero after the protocol switch. * Line 29 shows that after the simulation process lasted 600 s, the program execution process ended. The MS-SCTP method also needed to open up two arrays spaces of size \(n\) to store the maximum packet loss rate and the latest packet loss rate corresponding to each path, respectively. In the process of choosing a path, if there were multiple alternative paths, it needed an array with the maximum length of n to store the information of multiple alternative paths, and the space complexity was O(\(n\)). In the process of choosing the path, the algorithm needed to choose the path with lower packet loss rate. Therefore, it needed to compare the data in the array. In the process of comparison, the algorithm adopted the algorithm of quick sorting. When \(n\) connections were made, \(n\) pieces of data needed to be compared in the array, and the average time complexity of the quicksort algorithm was O(\(n\)lg2\(n\)). At this point, in the process of algorithm execution, the time spent on switching paths was the main time consumption, and the other time required could be regarded as \(t\). Therefore, the time required for each switch was \(t+n\)lg2\(n\), thus the time complexity of the algorithm was O(\(n\)lg2\(n\)). ## 4 Simulations and Analysis

### Simulation Results of MS-SCTP Method

In simulations, the same simulation scenario was used as 3.1, and the PERs were 0%, 10%, 20%, 30%, 40%, and 50%. The metrics throughput and packet loss rates of TCP, SCTP, and MS-SCTP were used in the simulations to analyze the advantages of MS-SCTP. Figure 7 shows the real-time throughput of the three schemes when the PER changed from 0% to 50%. Figure 7: _Cont._

As shown in Figure 7a, when the PER was zero, the real-time throughput curve of the SCTP multi-path switching scheme was basically the same as that of SCTP alone. The throughput difference between them was small. When the PER was zero, the external influence on data transmission was little. When transferring data, it was affected by a large number of packet errors. The condition that triggered the MS-SCTP did not occur. SCTP allowed the primary path chosen at the time of the initial coupling to be used to transfer data all the time. As a result, throughput remained stable. Since no path switching was involved, the default choice of a constant main path was used to transfer data. As the PER increased, such as in Figure 7b, the MS-SCTP showed advantages. The PER was greater than 10%.