Communication port switching method, device, electronic device and storage medium

By obtaining and sending the target port function in the port management server, and sending switching instructions when both ends are in the switching ready state, the two ends can communicate based on the same target port function, which solves the problem of data transmission interruption during port switching and improves This ensures the security and reliability of the communication port.

CN115883365BActive Publication Date: 2025-01-21NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211664948.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-23
Publication Date
2025-01-21
Estimated Expiration
2042-12-23

AI Technical Summary

Technical Problem

In the prior art, when communication between the client and the server, data transmission is easily interrupted during port switching, resulting in a high probability of data transmission failure.

Method used

By obtaining the target port function in the port management server and sending it to the first end and the second end to be communicated respectively. When it is detected that both ends are in the switching ready state, a function switching instruction is sent to enable the two ends to communicate based on the same target port function.

Benefits of technology

Significantly improves the security and reliability of communication ports, reduces the probability of data transmission failure, and avoids interruption of data transmission during port switching.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115883365B_ABST
    Figure CN115883365B_ABST
Patent Text Reader

Abstract

The present invention provides a communication port switching method, device, electronic device and storage medium, comprising: obtaining a target port function, and sending the target port function to a first end and a second end to be communicated respectively; wherein the target port function is used to determine a target port; when monitoring that the first end and the second end are both in a switching ready state, sending a function switching instruction to the first end and the second end respectively, so that the first end and the second end communicate based on the target port function; wherein the switching ready state is a state in which the target port can be operated. The present invention can significantly improve the security and reliability of the communication port and effectively reduce the probability of data transmission failure.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technology, and in particular to a switching method, device, electronic equipment and storage medium for a communication port. Background Art

[0002] At present, the default port is usually used for communication between the client and the server. For example, when the SSH (Secure Shell) communication protocol is used, port 22 is used by default, which is very easy to be scanned and cracked by malicious programs (such as viruses, Trojans, etc.). Therefore, related technologies propose that different ports can be used in different time periods, such as using port 13456 for a period of time and port 14980 for another period of time. However, the server needs to inform the client of the port number of the target port, otherwise the client will not be able to communicate with the server. In addition, if the server is transmitting data with the client when the port is switched, the data transmission will be interrupted, resulting in data transmission failure. Summary of the invention

[0003] In view of this, an object of the present invention is to provide a communication port switching method, device, electronic device and storage medium, which can significantly improve the security and reliability of the communication port and effectively reduce the probability of data transmission failure.

[0004] In a first aspect, an embodiment of the present invention provides a method for switching a communication port, which is applied to a port management server, and comprises: obtaining a target port function, and sending the target port function to a first end and a second end to be communicated, respectively; wherein the target port function is used to determine a target port; when it is monitored that both the first end and the second end are in a switching ready state, sending a function switching instruction to the first end and the second end, respectively, so that the first end and the second end communicate based on the target port function; wherein the switching ready state is a state in which the target port can be operated.

[0005] In a second aspect, an embodiment of the present invention further provides a method for switching a communication port, which is applied to a first end and includes: receiving a target port function, and controlling the first end to be in a switching ready state; wherein the target port function is used to determine a target port, and the switching ready state is a state in which the target port can be run; receiving a function switching instruction, and controlling the first end to communicate with the second end through the target port; wherein the second end receives the target port function and is in the switching ready state.

[0006] In a third aspect, an embodiment of the present invention further provides a method for switching a communication port, which is applied to a second end and includes: receiving a target port function, and controlling the second end to be in a switching ready state; wherein the target port function is used to determine a target port, and the switching ready state is a state in which the target port can be run; receiving a function switching instruction, and controlling the second end to communicate with the first end through the target port; wherein the first end receives the target port function and is in the switching ready state.

[0007] In a fourth aspect, an embodiment of the present invention further provides a switching device for a communication port, which is applied to a port management server and includes: a function sending module, which is used to obtain a target port function and send the target port function to a first end and a second end to be communicated, respectively; wherein the target port function is used to determine a target port; an instruction sending module, which is used to send a function switching instruction to the first end and the second end, respectively, when it is monitored that the first end and the second end are both in a switching ready state, so that the first end and the second end communicate based on the target port function; wherein the switching ready state is a state in which the target port can be operated.

[0008] In a fifth aspect, an embodiment of the present invention further provides a switching device for a communication port, which is applied to a first end and includes: a first function receiving module, used to receive a target port function, and control the first end to be in a switching ready state; wherein the target port function is used to determine a target port, and the switching ready state is a state in which the target port can be run; a first port switching module, used to receive a function switching instruction, and control the first end to communicate with the second end through the target port; wherein the second end receives the target port function and is in the switching ready state.

[0009] In the sixth aspect, an embodiment of the present invention further provides a switching device for a communication port, which is applied to a second end and includes: a second function receiving module, used to receive a target port function, and control the second end to be in a switching ready state; wherein the target port function is used to determine a target port, and the switching ready state is a state in which the target port can be operated; a second port switching module, receiving a function switching instruction, and controlling the second end to communicate with the first end through the target port; wherein the first end receives the target port function and is in the switching ready state.

[0010] In the seventh aspect, an embodiment of the present invention further provides an electronic device, comprising a processor and a memory, wherein the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement any one of the methods provided in the first aspect, the second aspect, and the third aspect.

[0011] In the eighth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement any one of the methods provided in the first aspect, the second aspect, and the third aspect.

[0012] The switching method, device, electronic device and storage medium of the communication port provided by the embodiment of the present invention are applied to the port management server, firstly, the target port function is obtained, and the target port function is sent to the first end and the second end to be communicated respectively, and the target port function is used to determine the target port. When it is monitored that the first end and the second end are both in the switching ready state, that is, the first end and the second end are both in the state where the target port can be operated, the function switching instruction is sent to the first end and the second end respectively, so that the first end and the second end communicate based on the target port function. The above method can send the function switching instruction to the first end and the second end when it is monitored that the first end and the second end are in the switching ready state, so that the first end and the second end can determine the same target port based on the same target port function for communication, without the need for synchronization of ports between the first end and the second end, thereby significantly improving the security and reliability of the communication port, and effectively reducing the probability of data transmission failure.

[0013] The present invention provides a method, device, electronic device and storage medium for switching communication ports.

[0014] Quality, applied to the first end, if the target port function sent by the port management server is received, then 5 determines to enter the switching ready state, the target port function is used to determine the target port, if it is received

[0015] The function switching instruction sent by the port management server communicates with the second end based on the target port function. The above method can enter the switching ready state when receiving the target port function, and when receiving the function switching instruction, the first end can determine the target port based on the target port function.

[0016] The first end and the second end communicate with each other through the port, so that the first end and the second end determine the same target port based on the same target port function, without the need for synchronization of ports between the first end and the second end, thereby significantly improving the communication port

[0017] The security and reliability of the port can effectively reduce the probability of data transmission failure.

[0018] The communication port switching method, device, electronic device and storage medium provided by the embodiment of the present invention are applied to the second end. If a target port function sent by a port management server is received,

[0019] Determine to enter the switching ready state, the target port function is used to determine the target port, if a function switching instruction sent by the port management server is received, then the first end is switched based on the target port function.

[0020] The above method can enter a switching ready state when receiving a target port function, and when receiving a function switching instruction, the second end can communicate with the first end based on the target port determined by the target port function, so that the first end and the second end can determine the same target port based on the same target port function.

[0021] The same target port does not require port synchronization between the first end and the second end, thereby significantly improving the security and reliability of the communication port 0 and effectively reducing the probability of data transmission failure.

[0022] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description, claims and drawings.

[0023] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the following is a detailed description of preferred embodiments with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0025] Figure 1 A schematic flow chart of a communication port switching method provided by an embodiment of the present invention;

[0026] Figure 2 A schematic flow chart of another communication port switching method provided by an embodiment of the present invention;

[0027] Figure 3 A schematic flow chart of another communication port switching method provided by an embodiment of the present invention;

[0028] Figure 4 A schematic flow chart of another communication port switching method provided by an embodiment of the present invention;

[0029] Figure 5 A schematic diagram of the structure of a switching device for a communication port provided by an embodiment of the present invention;

[0030] Figure 6 A schematic structural diagram of another communication port switching device provided by an embodiment of the present invention;

[0031] Figure 7 A schematic structural diagram of another communication port switching device provided by an embodiment of the present invention;

[0032] Figure 8 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0033] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described in combination with the embodiments below. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0034] At present, the existing port switching method has problems such as poor security and high probability of data transmission failure. Based on this, the present invention implements a communication port switching method, device, electronic device and storage medium, which can significantly improve the security and reliability of the communication port and effectively reduce the probability of data transmission failure.

[0035] To facilitate understanding of this embodiment, a communication port switching method disclosed in an embodiment of the present invention is first introduced in detail, which is applied to a port management server (abbreviated as Mgr) for switching different port functions. Figure 1 The flowchart of a method for switching a communication port is shown in FIG. 1 , and the method mainly includes the following steps S102 to S104:

[0036] Step S102, obtain the target port function, and send the target port function to the first end and the second end to be communicated respectively. The target port function is used to determine the target port, the first end can be the server end (referred to as Ser), and the second end can be the client end (referred to as Cli). In one embodiment, a plurality of initial port functions are pre-configured in the port management server, from which an initial port function can be randomly selected as an alternative port function, and each random variable in the alternative port function is assigned a value to obtain the target port function, thereby sending the target port function to the server end and the client end respectively, so that the server end and the client end temporarily store the target port function, and at this time the server end and the client end still communicate based on the target port determined by the current port function.

[0037] Step S104, when it is monitored that both the first end and the second end are in the switching ready state, the function switching instruction is sent to the first end and the second end respectively, so that the first end and the second end communicate based on the target port function. The switching ready state is also the state in which the target port can be run at any time. Optionally, when the server or the client receives the target port function, it can enter the switching ready state. At this time, the server and the client have the same target port function. The function switching instruction is used to instruct the server and the client to use the target port function to cover the current port function, so that the server and the client communicate based on the target port determined by the target port function.

[0038] The communication port switching method provided by the embodiment of the present invention can send a function switching instruction to the first end and the second end when it is monitored that the first end and the second end are in a switching ready state, so that the first end and the second end can determine the same target port for communication based on the same target port function, without the need for port synchronization between the first end and the second end, thereby significantly improving the security and reliability of the communication port and effectively reducing the probability of data transmission failure.

[0039] To facilitate understanding of the aforementioned target port function, an embodiment of the present invention provides an implementation method for obtaining the target port function, specifically:

[0040] (1) Determine an alternative port function from a plurality of pre-configured initial port functions. The alternative port function is related to the port switching period, and the alternative port function is provided with a plurality of random variables. The port switching period is used to characterize the period of switching the current port used by the first end and the second end. Exemplarily, the port switching period may be one day, one week, one month, etc., and may be specifically configured based on actual needs. In one embodiment, the alternative port function may be randomly selected from the initial port function. Exemplarily, the port function may be time-related, such as:

[0041] (1.1) port1 = (week n1 + first parameter) % second parameter + third parameter. This port function can change the target port number every day. Wherein, port1 is the port number, the port switching cycle is one week, and the current week (week n1) is used as the time parameter. At least one of the first parameter, the second parameter, and the third parameter is a random variable. Assuming that the first parameter is a random variable, and the second parameter and the third parameter are constants, then port1 = (week n1 + random variable) % 61 + 12345;

[0042] (1.2) port2 = (the n2th hour of the day + the fourth parameter) % the fifth parameter + the sixth parameter. This port function can change the target port number every hour. As above, port2 is the port number, the port switching cycle is one day, and the current time (the n2th hour) is used as the time parameter. At least one of the fourth parameter, the fifth parameter, and the sixth parameter is a random variable. Assuming that the fourth parameter is a random variable, and the fifth parameter and the sixth parameter are constants, then port2 = (the n2th hour of the day + the random variable) % 17 + 100002.

[0043] Exemplarily, it is assumed that a port function port1=(week n1+random variable)%61+12345 is randomly selected as an alternative port function.

[0044] (2) According to the port switching cycle and the variable value of the random variable in the alternative port function, the target port function is obtained. The target port function is recorded as func_new. In practical applications, each random variable has multiple random values ​​to choose from. For example, assuming that the above random variable is 12, the target port function is port1 = (week n1 + 12) % 61 + 12345.

[0045] On this basis, the embodiment of the present invention provides an implementation method of sending the target port function to the first end and the second end to be communicated respectively, specifically:

[0046] (I) Sending the target port function to the first end to be communicated, so that the first end determines the time parameter according to the port switching cycle of the target port function, and determines the target port according to the time parameter through the target port function. After the target port function is sent to the first end, and the first end and the second end are both in a switching ready state, a time parameter matching the port switching cycle can be selected, such as if the port switching cycle is one week, the time parameter is week n1, such as if the port switching cycle is one day, the time parameter is the n2th hour, and the time parameter is substituted into the target port function to obtain the port number of the corresponding target port.

[0047] (ii) sending the target port function to the second end to be communicated, so that the second end determines the time parameter according to the port switching cycle matched by the target port function, and determines the target port according to the time parameter through the target port function. In the specific implementation, the implementation process of determining the port number of the target port by the first end mentioned above can be referred to, and the embodiment of the present invention will not be repeated here.

[0048] In one implementation, if a response instruction fed back by the server or the client is received, it can be determined that both the first end and the second end are in a switching ready state, specifically:

[0049] (1) If the first response instruction fed back by the first end is received within the first preset time length, it is determined that the first end is in a switching ready state; conversely, if the first response instruction fed back by the first end is not received within the first preset time length, the target port function is sent to the first end again until the first response instruction fed back by the first end is received within the first preset time length. Exemplarily, assuming that the first preset time length is 5 minutes, and the first response instruction is "received", if the "received" instruction fed back by the server end is received within 5 minutes, it is determined that the server end is in a switching ready state, and if the "received" instruction fed back by the server end is not received within 5 minutes, the target port function is resent to the server end.

[0050] (2) If the second response instruction fed back by the second end is received within the first preset time length, it is determined that the second end is in the switching ready state. Conversely, if the second response instruction fed back by the second end is not received within the first preset time length, the target port function is sent to the second end again until the second response instruction fed back by the second end is received within the first preset time length. Exemplarily, assuming that the first preset time length is 5 minutes, and the second response instruction is "received", if the "received" instruction fed back by the client is received within 5 minutes, it is determined that the client is in the switching ready state. If the "received" instruction fed back by the client is not received within 5 minutes, the target port function is resent to the client.

[0051] In actual applications, if both the server and the client are in a ready-to-switch state, a function switching instruction can be sent to the server and the client, respectively, so that the server and the client can immediately apply the target port function. For example, assuming that the function switching instruction is "use the new function immediately", since both the server and the client have fed back the response instruction, indicating that the probability of the signal receiving and sending channel being normal is relatively high, "use the new function immediately" can also be sent successfully with a high probability, so that the server and the client can switch from the current port function to the target port function, and communicate based on the target port determined by the target port function, where the current port function is recorded as func_old.

[0052] Considering that if the target port function is directly used to cover the current port function, there will be a short-term situation where the port function is different, such as the target port function directly covers the function currently being used by the server, and it is immediately different from the function currently being used by the client, or if the target port function directly covers the function currently being used by the server, and the port management server is disconnected from the client, that is, the port management server cannot communicate with the client, at this time, the target port function cannot cover the function currently being used by the client, which will cause the situation that the client and the server are currently using different functions to last for a long time. Therefore, the embodiment of the present invention proposes that when the server and the client receive the target port function, the target port function will be temporarily stored, rather than directly using the target port function, and when the first end and the second end are both in a switching ready state, after receiving the function switching instruction, the target port function is used to cover the current port function, so that the function currently being used by the server is the same as the port function currently being used by the client. In addition, preparing the function may also take time, such as the client preparing a new function to be available, which may take 2 seconds; the server preparing a new function to be available, which may take 5 seconds, when the server and the client are both ready, they are covered at the same time, and the situation that the client and the server are currently using different functions at this time lasts for a short time.

[0053] Based on the above embodiments, the present invention provides another communication port switching method, which is applied to the first end. Figure 2 FIG. 1 is a flow chart of another method for switching a communication port, the method mainly comprising the following steps S202 to S204:

[0054] Step S202, receiving the target port function, and controlling the first end to be in a switching ready state. The target port function is used to determine the target port, and the switching ready state is a state in which the target port can be operated. In one embodiment, if the server receives the target port function, it will send a first response instruction to the port management server within a first preset time length, and enter the switching ready state, and the server will temporarily store the target port function.

[0055] Step S204, receiving a function switching instruction, controlling the first end and the second end to communicate through the target port; wherein the second end receives the target port function and is in a switching ready state. In one embodiment, the time parameter can be determined according to the port switching cycle matched by the target port function, and then the target port is determined according to the time parameter by the target port function, thereby controlling the first end and the second end to communicate through the target port. Exemplarily, assuming that the target port function is port1=(week n1+12)%61+12345, wherein the port switching cycle matched by the target port function is determined to be every day, and the time parameter is an integer between 1 and 7, if the current time is Friday, the time parameter is determined to be 5, at this time port1=(5+12)%61+12345, thereby obtaining a new port number, the port corresponding to the port number is the target port, and the target port is immediately opened, that is, the target port is operated to receive new connections.

[0056] The communication port switching method provided by the embodiment of the present invention can enter a switching ready state when a target port function is received, and when a function switching instruction is received, the first end can communicate with the second end based on the target port determined by the target port function, so that the first end and the second end determine the same target port based on the same target port function, and there is no need to synchronize the ports between the first end and the second end, thereby significantly improving the security and reliability of the communication port and effectively reducing the probability of data transmission failure.

[0057] In one embodiment, for the server, when "the current port function changes", or when "time changes (such as Monday becomes Tuesday), resulting in a change in the port calculated according to the current port function", a new target port needs to be used. At this time, the server will first immediately open the use of the new target port, that is, run the target port to receive new connections, and then determine the way to close the current port according to whether the current port still has data connection or data transmission, specifically:

[0058] (a1) If the first end is transmitting data with the second end through the current port, a pre-close signal is sent to the second end, so that the second end interrupts the data transmission based on the pre-close signal. For example, the pre-close signal can be "I am about to close this port", expecting the client to actively try to interrupt the data transmission.

[0059] (a2) If the second end is detected to interrupt data transmission within the second preset time period, the current port is controlled to be closed; or, if the second end is not detected to interrupt data transmission within the second preset time period, the current port is controlled to be closed. For example, assuming that the second preset time period is 10 minutes, if the client is detected to interrupt data transmission within 10 minutes, the server can directly close the current port; if the client still does not interrupt data transmission after 10 minutes, the server will forcibly close the current port.

[0060] Based on the above embodiments, the present invention provides another communication port switching method, which is applied to the second end. Figure 3 FIG. 1 is a flow chart of another method for switching a communication port, the method mainly comprising the following steps S302 to S304:

[0061] Step S302, receiving the target port function, and controlling the second end to be in a switch-ready state. The target port function is used to determine the target port, and the switch-ready state is a state in which the target port can be run. In one embodiment, if the client receives the target port function, it will send a second response instruction to the port management server within a first preset time length, and enter the switch-ready state, and the client will temporarily store the target port function.

[0062] Step S304, receiving a function switching instruction, and controlling the second end to communicate with the first end through the target port; wherein the first end receives the target port function and is in a switching ready state. In one embodiment, a time parameter can be determined according to a port switching cycle matched by the target port function, and then the target port is determined according to the time parameter by the target port function, thereby controlling the second end to communicate with the first end through the target port. For details, please refer to the aforementioned step S204, which will not be described in detail in the embodiment of the present invention.

[0063] The communication port switching method provided by the embodiment of the present invention can enter a switching ready state when a target port function is received, and when a function switching instruction is received, the second end can communicate with the first end based on the target port determined by the target port function, so that the first end and the second end determine the same target port based on the same target port function, and there is no need to synchronize the ports between the first end and the second end, thereby significantly improving the security and reliability of the communication port and effectively reducing the probability of data transmission failure.

[0064] In actual applications, if the second end transmits data with the first end through the current port, and receives a pre-close signal sent by the first end, the data transmission is interrupted based on the pre-close signal, and the data transmission is resumed according to the target port. Exemplarily, when the client receives the message "I am about to close this port" sent by the server, the client attempts to interrupt the data transmission, recalculates the target port according to the "target port function" and the "current time", establishes a connection with the server on the target port, and resumes the data transmission. Specifically, when the client attempts to interrupt the data transmission, it can lock / suspend the data transmission thread, and calculate the target port according to the "target port function" and the "current time", so as to establish a connection with the server according to the target port. The data transmission thread reuses the connection. At this time, the client can resume the data transmission by unlocking / resuming the data transmission thread.

[0065] In one implementation, if the client cannot re-establish a connection with the server, an error prompt or an error log may be generated, such as generating a related email and sending the email to an associated terminal of the user.

[0066] In another implementation, if the port management server crashes, the server and the client can still use the current port function to calculate the target port number.

[0067] In another embodiment, if the user receives an email alert and finds after inspection that the target ports determined by the server and the client are always unequal, the user can: (1) check whether the system time difference between the server and the client is too large; (2) manually request the port management server to regenerate the target port function and send it to the server and the client.

[0068] To facilitate understanding of the above embodiments, an embodiment of the present invention provides an application example of a method for switching a communication port, see Figure 4 FIG. 4 is a flow chart of another method for switching a communication port, the method mainly comprising the following steps S402 to S426:

[0069] Step S402, Mgr periodically switches the target port function.

[0070] Step S404, Mgr sends the target port function to Ser.

[0071] Step S406, Mgr sends the target port function to Cli.

[0072] Step S408, Mgr waits for Ser and Cli to feedback a response instruction.

[0073] Step S410, Mgr sends function switching instructions to Ser and Cli respectively.

[0074] Step S412, Cli uses the target port function as the "current port function".

[0075] Step S414, Cli opens the target port according to the "current port function" and the "current time".

[0076] Step S416, Ser takes the target port function as the "current port function".

[0077] Step S418, Ser opens the target port according to the "current port function" and the "current time".

[0078] Step S420, Ser opens the target port and determines whether there is data transmission on the current port. If yes, execute step S424; if not, execute step S422.

[0079] Step S422, Ser closes the current port.

[0080] Step S424, requiring the Cli to actively close the current port, otherwise the current port is forcibly closed after a second preset time period.

[0081] Step S426, when Cli receives Ser's request to close the current port, it attempts to stop data transmission and attempts to resume data transmission according to the "current port function" and the "current time".

[0082] For the communication port switching method provided in the above embodiment, the present invention provides a communication port switching device, which is applied to a port management server, see Figure 5 The structure diagram of a switching device of a communication port shown in FIG. 1 mainly includes the following parts:

[0083] The function sending module 502 is used to obtain a target port function and send the target port function to the first end and the second end to be communicated respectively; wherein the target port function is used to determine the target port;

[0084] The instruction sending module 504 is used to send function switching instructions to the first end and the second end respectively when it is monitored that both the first end and the second end are in a switching ready state, so that the first end and the second end communicate based on the target port function; wherein the switching ready state is a state in which the target port can be operated.

[0085] The switching device of the communication port provided by the embodiment of the present invention can send a function switching instruction to the first end and the second end when it monitors that the first end and the second end are in a switching ready state, so that the first end and the second end can determine the same target port for communication based on the same target port function, without the need for port synchronization between the first end and the second end, thereby significantly improving the security and reliability of the communication port and effectively reducing the probability of data transmission failure.

[0086] In one embodiment, the function sending module 502 is also used to: determine an alternative port function from a plurality of pre-configured initial port functions; wherein the alternative port function is related to a port switching cycle, the alternative port function is provided with a plurality of random variables, and the port switching cycle is used to characterize the cycle of the current port used for switching the first end and the second end; obtain the target port function according to the port switching cycle and the variable value of each random variable in the alternative port function.

[0087] In one embodiment, the above-mentioned device also includes a status monitoring module, which is used to: if a first response instruction fed back by the first end is received within a first preset time length, determine that the first end is in a switching ready state; and if a second response instruction fed back by the second end is received within the first preset time length, determine that the second end is in a switching ready state.

[0088] In one embodiment, the status monitoring module is also used to: if a first response instruction fed back from the first end is not received within a first preset time period, send the target port function to the first end again until the first response instruction fed back from the first end is received within the first preset time period; or, if a second response instruction fed back from the second end is not received within the first preset time period, send the target port function to the second end again until the second response instruction fed back from the second end is received within the first preset time period.

[0089] In one embodiment, the function sending module 502 is also used to: send the target port function to the first end to be communicated, so that the first end determines the time parameter according to the port switching cycle of the target port function, and determines the target port according to the time parameter through the target port function; and send the target port function to the second end to be communicated, so that the second end determines the time parameter according to the port switching cycle matched by the target port function, and determines the target port according to the time parameter through the target port function.

[0090] For the communication port switching method provided in the above embodiment, the present invention provides another communication port switching device, which is applied to the first end, see Figure 6 The structural schematic diagram of another communication port switching device shown in FIG. 1 mainly includes the following parts:

[0091] The first function receiving module 602 is used to receive a target port function and control the first end to be in a switching ready state; wherein the target port function is used to determine the target port, and the switching ready state is a state in which the target port can be operated; wherein the target port function is used to determine the target port;

[0092] The first port switching module 604 is used to receive a function switching instruction and control the first end to communicate with the second end through the target port; wherein the second end receives the target port function and is in a switching ready state.

[0093] The switching device of the communication port provided by the embodiment of the present invention can enter a switching ready state when a target port function is received, and when a function switching instruction is received, the first end can communicate with the second end based on the target port determined by the target port function, so that the first end and the second end determine the same target port based on the same target port function, and there is no need to synchronize the ports between the first end and the second end, thereby significantly improving the security and reliability of the communication port and effectively reducing the probability of data transmission failure.

[0094] In one embodiment, the first port switching module 604 is further used to: determine a time parameter according to a port switching period matched by a target port function; determine a target port according to the time parameter through the target port function, and control the first end to communicate with the second end through the target port.

[0095] In one embodiment, the above-mentioned device also includes a pre-closing module, which is used to: if the first end transmits data with the second end through the current port, send a pre-closing signal to the second end, so that the second end interrupts the data transmission based on the pre-closing signal; if the second end is monitored to interrupt the data transmission within a second preset time length, control the current port to close; or, if the second end is not monitored to interrupt the data transmission within the second preset time length, control the current port to close.

[0096] For the communication port switching method provided in the above embodiment, the embodiment of the present invention further provides another communication port switching device, which is applied to the second end. See the structural schematic diagram of another communication port switching device shown in Figure 7. The device mainly includes the following parts:

[0097] The second function receiving module 702 is used to receive the target port function and control the second end to be in a switching ready state; wherein the target port function is used to determine the target port, and the switching ready state is a state in which the target port can be operated;

[0098] The second port switching module 704 is used to receive a function switching instruction and control the second end to communicate with the first end through the target port; wherein the first end receives the target port function and is in a switching ready state.

[0099] The switching device of the communication port provided by the embodiment of the present invention can enter a switching ready state when receiving a target port function, and when receiving a function switching instruction, the second end can communicate with the first end based on the target port determined by the target port function, so that the first end and the second end determine the same target port based on the same target port function, and there is no need to synchronize the ports between the first end and the second end, thereby significantly improving the security and reliability of the communication port and effectively reducing the probability of data transmission failure.

[0100] In one embodiment, the second port switching module 704 is further used to: determine a time parameter according to a port switching period matched by a target port function; determine a target port according to the time parameter through the target port function, and control the second end to communicate with the first end through the target port.

[0101] In one embodiment, the above-mentioned device also includes a data transmission module, which is used to: if the second end transmits data with the first end through the current port and receives a pre-close signal sent by the first end, interrupt the data transmission based on the pre-close signal, and resume the data transmission according to the target port.

[0102] The device provided in the embodiment of the present invention has the same implementation principle and technical effects as those of the aforementioned method embodiment. For the sake of brief description, for matters not mentioned in the device embodiment, reference may be made to the corresponding contents in the aforementioned method embodiment.

[0103] An embodiment of the present invention provides an electronic device. Specifically, the electronic device includes a processor and a storage device. The storage device stores a computer program. When the computer program is run by the processor, it executes:

[0104] A method for switching a communication port comprises: obtaining a target port function, and sending the target port function to a first end and a second end to be communicated respectively; wherein the target port function is used to determine a target port; when it is monitored that both the first end and the second end are in a switching-ready state, sending a function switching instruction to the first end and the second end respectively, so that the first end and the second end communicate based on the target port function; wherein the switching-ready state is a state in which the target port can be operated.

[0105] The electronic device provided by the embodiment of the present invention can send a function switching instruction to the first end and the second end when it is monitored that the first end and the second end are in a switching ready state, so that the first end and the second end can determine the same target port for communication based on the same target port function, without the need for port synchronization between the first end and the second end, thereby significantly improving the security and reliability of the communication port and effectively reducing the probability of data transmission failure.

[0106] In one embodiment, the step of obtaining the target port function includes: determining an alternative port function from a plurality of pre-configured initial port functions; wherein the alternative port function is related to a port switching cycle, the alternative port function is provided with a plurality of random variables, and the port switching cycle is used to characterize the cycle of the current port used for switching the first end and the second end; and obtaining the target port function according to the port switching cycle and the variable value of each random variable in the alternative port function.

[0107] In one embodiment, before the step of monitoring that both the first end and the second end are in a switching-ready state, the method also includes: if a first response instruction fed back by the first end is received within a first preset time length, determining that the first end is in a switching-ready state; and if a second response instruction fed back by the second end is received within the first preset time length, determining that the second end is in a switching-ready instruction.

[0108] In one embodiment, the method also includes: if a first response instruction fed back by the first end is not received within a first preset time length, sending the target port function to the first end again until the first response instruction fed back by the first end is received within the first preset time length; or, if a second response instruction fed back by the second end is not received within the first preset time length, sending the target port function to the second end again until the second response instruction fed back by the second end is received within the first preset time length.

[0109] In one embodiment, the step of sending the target port function to the first end and the second end to be communicated respectively includes: sending the target port function to the first end to be communicated, so that the first end determines the time parameter according to the port switching cycle of the target port function, and determines the target port according to the time parameter through the target port function; and sending the target port function to the second end to be communicated, so that the second end determines the time parameter according to the port switching cycle matched by the target port function, and determines the target port according to the time parameter through the target port function.

[0110] A method for switching a communication port, the method is applied to a first end, comprising: receiving a target port function, controlling the first end to be in a switching ready state; wherein the target port function is used to determine a target port, and the switching ready state is a state in which the target port can be operated; receiving a function switching instruction, controlling the first end to communicate with a second end through the target port; wherein the second end receives the target port function and is in the switching ready state.

[0111] The electronic device provided by an embodiment of the present invention can enter a switching ready state when a target port function is received, and when a function switching instruction is received, the first end can communicate with the second end based on the target port determined by the target port function, so that the first end and the second end determine the same target port based on the same target port function, and there is no need to synchronize the ports between the first end and the second end, thereby significantly improving the security and reliability of the communication port and effectively reducing the probability of data transmission failure.

[0112] In one embodiment, controlling the first end and the second end to communicate through the target port includes: determining a time parameter according to a port switching period matched by a target port function; determining a target port according to the time parameter through a target port function, and controlling the first end and the second end to communicate through the target port.

[0113] In one embodiment, the method also includes: if the first end transmits data with the second end through the current port, sending a pre-close signal to the second end, so that the second end interrupts the data transmission based on the pre-close signal; if the second end is monitored to interrupt the data transmission within a second preset time length, controlling the current port to close; or, if the second end is not monitored to interrupt the data transmission within the second preset time length, controlling the current port to close.

[0114] A method for switching a communication port, the method is applied to a second end, comprising: receiving a target port function, controlling the second end to be in a switching ready state; wherein the target port function is used to determine the target port, and the switching ready state is a state in which the target port can be operated; receiving a function switching instruction, controlling the second end to communicate with the first end through the target port; wherein the first end receives the target port function and is in a switching ready state.

[0115] The electronic device provided by an embodiment of the present invention can enter a switching ready state when a target port function is received, and when a function switching instruction is received, the second end can communicate with the first end based on the target port determined by the target port function, so that the first end and the second end determine the same target port based on the same target port function, and there is no need to synchronize the ports between the first end and the second end, thereby significantly improving the security and reliability of the communication port and effectively reducing the probability of data transmission failure.

[0116] In one embodiment, the step of controlling the second end to communicate with the first end through the target port includes: determining a time parameter according to a port switching period matched by a target port function; determining a target port according to the time parameter through the target port function, and controlling the second end to communicate with the first end through the target port.

[0117] In one embodiment, the method further includes: if the second end transmits data with the first end through the current port and receives a pre-close signal sent by the first end, interrupting the data transmission based on the pre-close signal and resuming the data transmission according to the target port.

[0118] Figure 8 A structural diagram of an electronic device provided in an embodiment of the present invention, the electronic device 100 includes: a processor 80, a memory 81, a bus 82 and a communication interface 83, wherein the processor 80, the communication interface 83 and the memory 81 are connected via the bus 82; the processor 80 is used to execute an executable module stored in the memory 81, such as a computer program.

[0119] The memory 81 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk memory. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 83 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used.

[0120] The bus 82 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0121] Among them, the memory 81 is used to store programs, and the processor 80 executes the program after receiving the execution instruction. The method executed by the device for flow process definition disclosed in any embodiment of the above-mentioned embodiments of the present invention can be applied to the processor 80 or implemented by the processor 80.

[0122] The processor 80 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 80. The above processor 80 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in the embodiments of the present invention can be directly embodied as a hardware decoding processor to be executed, or the hardware and software modules in the decoding processor can be executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 81, and the processor 80 reads the information in the memory 81 and completes the steps of the above method in combination with its hardware.

[0123] The computer program product of a readable storage medium provided in an embodiment of the present invention includes a computer readable storage medium storing program code, and the instructions included in the program code can be used to execute:

[0124] A method for switching a communication port, the method is applied to a port management server, comprising: obtaining a target port function, and sending the target port function to a first end and a second end to be communicated respectively; wherein the target port function is used to determine a target port; when it is monitored that both the first end and the second end are in a switching ready state, sending a function switching instruction to the first end and the second end respectively, so that the first end and the second end communicate based on the target port function; wherein the switching ready state is a state in which the target port can be operated.

[0125] The readable storage medium provided by an embodiment of the present invention can send a function switching instruction to the first end and the second end when it is monitored that the first end and the second end are in a switching ready state, so that the first end and the second end can determine the same target port for communication based on the same target port function, without the need for port synchronization between the first end and the second end, thereby significantly improving the security and reliability of the communication port and effectively reducing the probability of data transmission failure.

[0126] In one embodiment, the step of obtaining the target port function includes: determining an alternative port function from a plurality of pre-configured initial port functions; wherein the alternative port function is related to a port switching cycle, the alternative port function is provided with a plurality of random variables, and the port switching cycle is used to characterize the cycle of switching the current port used by the first end and the second end; obtaining the target port function according to the port switching cycle and the variable value of each random variable in the alternative port function.

[0127] In one embodiment, before the step of monitoring that both the first end and the second end are in a switching-ready state, the method also includes: if a first response instruction fed back by the first end is received within a first preset time length, determining that the first end is in a switching-ready state; and if a second response instruction fed back by the second end is received within the first preset time length, determining that the second end is in a switching-ready instruction.

[0128] In one embodiment, the method also includes: if a first response instruction fed back by the first end is not received within a first preset time length, sending the target port function to the first end again until the first response instruction fed back by the first end is received within the first preset time length; or, if a second response instruction fed back by the second end is not received within the first preset time length, sending the target port function to the second end again until the second response instruction fed back by the second end is received within the first preset time length.

[0129] In one embodiment, the step of sending the target port function to the first end and the second end to be communicated respectively includes: sending the target port function to the first end to be communicated, so that the first end determines the time parameter according to the port switching cycle of the target port function, and determines the target port according to the time parameter through the target port function; and sending the target port function to the second end to be communicated, so that the second end determines the time parameter according to the port switching cycle matched by the target port function, and determines the target port according to the time parameter through the target port function.

[0130] In a second aspect, an embodiment of the present invention further provides a method for switching a communication port, which is applied to a first end and includes: receiving a target port function, and controlling the first end to be in a switching ready state; wherein the target port function is used to determine a target port, and the switching ready state is a state in which the target port can be run; receiving a function switching instruction, and controlling the first end to communicate with the second end through the target port; wherein the second end receives the target port function and is in the switching ready state.

[0131] The readable storage medium provided by an embodiment of the present invention can enter a switching ready state when a target port function is received, and when a function switching instruction is received, the first end can communicate with the second end based on the target port determined by the target port function, so that the first end and the second end determine the same target port based on the same target port function, and there is no need to synchronize the ports between the first end and the second end, thereby significantly improving the security and reliability of the communication port and effectively reducing the probability of data transmission failure.

[0132] In one embodiment, the step of controlling the first end and the second end to communicate through the target port includes: determining a time parameter according to a port switching period matched by a target port function; determining a target port according to the time parameter through a target port function, and controlling the first end and the second end to communicate through the target port.

[0133] In one embodiment, the method also includes: if the first end transmits data with the second end through the current port, sending a pre-close signal to the second end, so that the second end interrupts the data transmission based on the pre-close signal; if the second end is monitored to interrupt the data transmission within a second preset time length, controlling the current port to close; or, if the second end is not monitored to interrupt the data transmission within the second preset time length, controlling the current port to close.

[0134] A method for switching a communication port, the method is applied to a second end, comprising: receiving a target port function, controlling the second end to be in a switching ready state; wherein the target port function is used to determine the target port, and the switching ready state is a state in which the target port can be operated; receiving a function switching instruction, controlling the second end to communicate with the first end through the target port; wherein the first end receives the target port function and is in a switching ready state.

[0135] The readable storage medium provided by an embodiment of the present invention can enter a switching ready state when a target port function is received, and when a function switching instruction is received, the second end can communicate with the first end based on the target port determined by the target port function, so that the first end and the second end determine the same target port based on the same target port function, and there is no need to synchronize the ports between the first end and the second end, thereby significantly improving the security and reliability of the communication port and effectively reducing the probability of data transmission failure.

[0136] In one embodiment, the step of controlling the second end to communicate with the first end through the target port includes: determining a time parameter according to a port switching period matched by a target port function; determining a target port according to the time parameter through the target port function, and controlling the second end to communicate with the first end through the target port.

[0137] In one embodiment, the method further includes: if the second end transmits data with the first end through the current port and receives a pre-close signal sent by the first end, interrupting the data transmission based on the pre-close signal and resuming the data transmission according to the target port.

[0138] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only disk) and other media that can store program codes.

[0139] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims

1. A method for switching a communication port, characterized in that: Applied to a port management server, the method comprises: Acquire a target port function, and send the target port function to the first end and the second end to be communicated respectively; wherein the target port function is used to determine the target port; When it is monitored that both the first end and the second end are in a switching ready state, a function switching instruction is sent to the first end and the second end respectively, so that the first end and the second end communicate based on the target port determined by the target port function; wherein the switching ready state is a state in which the target port can be operated; The function of obtaining the target port includes: Determine an alternative port function from a plurality of pre-configured initial port functions; wherein the alternative port function is related to a port switching period, the alternative port function is provided with a random variable, the port switching period is used to characterize a period of switching a current port used by the first end and the second end, and the alternative port function includes a time parameter, a random variable and a constant; A target port function is obtained according to the port switching period and the variable value of the random variable in the candidate port function, and the port switching period of the target port function is used to determine a time parameter.

2. The method according to claim 1, characterized in that Before monitoring that both the first end and the second end are in a switching ready state, the method further includes: If a first response instruction fed back by the first end is received within a first preset time period, it is determined that the first end is in a switching ready state; And, if a second response instruction fed back by the second end is received within the first preset time period, it is determined that the second end is in the switching ready state.

3. The method according to claim 2, characterized in that The method further comprises: If the first response instruction fed back by the first end is not received within the first preset time length, the target port function is sent to the first end again until the first response instruction fed back by the first end is received within the first preset time length; Alternatively, if the second response instruction fed back by the second end is not received within the first preset time period, the target port function is sent to the second end again until the second response instruction fed back by the second end is received within the first preset time period.

4. The method according to claim 1, characterized in that The step of sending the target port function to the first end and the second end to be communicated respectively comprises: Sending the target port function to a first end to be communicated, so that the first end determines a time parameter according to a port switching period of the target port function, and determines a target port according to the time parameter through the target port function; And, the target port function is sent to the second end to be communicated, so that the second end determines the time parameter according to the port switching cycle matched by the target port function, and determines the target port according to the time parameter through the target port function.

5. A method for switching a communication port, characterized in that: The method is applied to a first end, which is a server end, and includes: receiving a target port function, and controlling the first end to be in a switching ready state; wherein the target port function is used to determine a target port, and the switching ready state is a state in which the target port can be operated; receiving a function switching instruction, and controlling the first end to communicate with the second end through the target port; wherein the second end receives the target port function and is in the switching ready state; The process of acquiring the target port function includes: Determine an alternative port function from a plurality of pre-configured initial port functions; wherein the alternative port function is related to a port switching period, the alternative port function is provided with a random variable, the port switching period is used to characterize a period of switching a current port used by the first end and the second end, and the alternative port function includes a time parameter, a random variable and a constant; A target port function is obtained according to the port switching period and the variable value of the random variable in the candidate port function, and the port switching period of the target port function is used to determine a time parameter.

6. The method according to claim 5, characterized in that The controlling the first end to communicate with the second end through the target port includes: Determining a time parameter according to a port switching period of the target port function; The target port function is used to determine the target port according to the time parameter, and the first end is controlled to communicate with the second end through the target port.

7. The method according to claim 5, characterized in that The method further comprises: If the first end is performing data transmission with the second end through the current port, sending a pre-close signal to the second end, so that the second end interrupts the data transmission based on the pre-close signal; If it is detected that the second end interrupts data transmission within the second preset time period, the current port is controlled to be closed; or if it is not detected that the second end interrupts data transmission within the second preset time period, the current port is controlled to be closed.

8. A method for switching a communication port, characterized in that: The method is applied to a second end, where the second end is a client, and includes: receiving a target port function, and controlling the second end to be in a switching ready state; wherein the target port function is used to determine a target port, and the switching ready state is a state in which the target port can be operated; receiving a function switching instruction, and controlling the second end to communicate with the first end through the target port; wherein the first end receives the target port function and is in the switching ready state; The process of acquiring the target port function includes: Determine an alternative port function from a plurality of pre-configured initial port functions; wherein the alternative port function is related to a port switching period, the alternative port function is provided with a random variable, the port switching period is used to characterize a period of switching a current port used by the first end and the second end, and the alternative port function includes a time parameter, a random variable and a constant; A target port function is obtained according to the port switching period and the variable value of the random variable in the candidate port function, and the port switching period of the target port function is used to determine a time parameter.

9. The method according to claim 8, characterized in that The step of controlling the second end to communicate with the first end through the target port comprises: Determine a time parameter according to a port switching period matched by the target port function; The target port is determined according to the time parameter through the target port function, and the second end is controlled to communicate with the first end through the target port.

10. The method according to claim 8, characterized in that The method further comprises: If the second end performs data transmission with the first end through the current port and receives a pre-close signal sent by the first end, the data transmission is interrupted based on the pre-close signal, and the data transmission is resumed according to the target port.

11. A communication port switching device, characterized in that: Applied to a port management server, the device comprises: A function sending module, used for acquiring a target port function, and sending the target port function to the first end and the second end to be communicated respectively; wherein the target port function is used for determining a target port; an instruction sending module, configured to send a function switching instruction to the first end and the second end respectively when monitoring that both the first end and the second end are in a switching ready state, so that the first end and the second end communicate with each other based on the target port determined by the target port function; wherein the switching ready state is a state in which the target port can be operated; The function sending module is also used to: determine an alternative port function from a plurality of pre-configured initial port functions; wherein the alternative port function is related to a port switching period, the alternative port function is provided with a plurality of random variables, the port switching period is used to characterize a period of switching a current port used by a first end and a second end, the alternative port function includes a time parameter, a random variable and a constant; and obtain a target port function according to the port switching period and the variable value of each random variable in the alternative port function, wherein the port switching period of the target port function is used to determine the time parameter.

12. A communication port switching device, characterized in that: The device is applied to a first end, which is a server end, and includes: A first function receiving module, used for receiving a target port function, and controlling the first end to be in a switching ready state; wherein the target port function is used for determining a target port, and the switching ready state is a state in which the target port can be operated; A first port switching module, configured to receive a function switching instruction and control the first end to communicate with the second end through the target port; wherein the second end receives the target port function and is in the switching ready state; The process of acquiring the target port function includes: Determine an alternative port function from a plurality of pre-configured initial port functions; wherein the alternative port function is related to a port switching period, the alternative port function is provided with a random variable, the port switching period is used to characterize a period of switching a current port used by the first end and the second end, and the alternative port function includes a time parameter, a random variable and a constant; A target port function is obtained according to the port switching period and the variable value of the random variable in the candidate port function, and the port switching period of the target port function is used to determine a time parameter.

13. A communication port switching device, characterized in that: The device is applied to a second end, where the second end is a client, and includes: A second function receiving module, used for receiving a target port function, and controlling the second end to be in a switching ready state; wherein the target port function is used for determining a target port, and the switching ready state is a state in which the target port can be operated; A second port switching module receives a function switching instruction and controls the first end and the second end to communicate through the target port; wherein the first end receives the target port function and is in the switching ready state; The process of acquiring the target port function includes: Determine an alternative port function from a plurality of pre-configured initial port functions; wherein the alternative port function is related to a port switching period, the alternative port function is provided with a random variable, the port switching period is used to characterize a period of switching a current port used by the first end and the second end, and the alternative port function includes a time parameter, a random variable and a constant; A target port function is obtained according to the port switching period and the variable value of the random variable in the candidate port function, and the port switching period of the target port function is used to determine a time parameter.

14. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the method according to any one of claims 1 to 10.

15. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the method according to any one of claims 1 to 10.

Citation Information

Patent Citations

  • FTP file reliable transmission method based on port hopping

    CN107094183A