Ship-side software operation and maintenance method and related components based on HTTP communication under restricted network conditions
By adopting the ship-side software operation and maintenance method based on HTTP communication under restricted network conditions in the ship management system, and using the technology of dynamically adjusting the download strategy, the problem of unstable data transmission during ships' ocean-going navigation is solved, and efficient updates of ship-side software and data integrity guarantees are achieved.
Patent Information
- Application Number
- CN202411239840.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-05
- Publication Date
- 2025-03-04
- Estimated Expiration
- 2044-09-05
AI Technical Summary
In the ship management system, the communication link is unstable, especially during ocean navigation, the satellite communication system has low bandwidth and high signal delay, which affects real-time communication and online operations, resulting in abnormal data transmission processes. Especially when the ship-side software is updated, how to effectively update the network under unstable and bandwidth is a problem that needs to be solved urgently.
It provides a ship-side software operation and maintenance method based on HTTP communication under restricted network conditions. Through the interaction between the ship-side industrial control machine and the shore-side server, file division and multi-threaded downloading are used to dynamically adjust the download strategy according to network speed to ensure the stability and integrity of file downloads.
It improves the stability and efficiency of data transmission between ships and shores, ensures data integrity during the update process of ship-side software, reduces network bandwidth usage, and can quickly resume downloading after network interruption.
Smart Images

Figure CN118764479B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of information technology, and in particular to a ship-side software operation and maintenance method based on HTTP communication under restricted network conditions and related components. Background Art
[0002] In the ship management system, the communication link is extremely unstable. When the ship is near the shore, it can use the surface mobile network (such as 4G / LTE), but when sailing in the ocean, it must rely on the satellite communication system. The satellite communication system usually has a low bandwidth, and the network bandwidth on the ship is also low, which limits the speed and capacity of data transmission. In addition, the satellite communication signal has a high delay and the coverage is still not comprehensive, which affects the real-time communication and online operation, resulting in abnormal data transmission between the ship and the shore.
[0003] In recent years, with the popularization of smart ships, more and more detection software has been deployed on the ship side. How to update the ship side software when the ship side network is unstable and the transmission bandwidth is limited is an urgent problem that needs to be solved. Summary of the invention
[0004] In order to improve the stability of data transmission between ship and shore under restricted network conditions, the present application provides a ship-side software operation and maintenance method based on HTTP communication under restricted network conditions and related components.
[0005] In the first aspect, the present application provides a method for operating and maintaining ship-side software based on HTTP communication under restricted network conditions, which adopts the following technical solutions:
[0006] Executed by the ship-side industrial computer, including:
[0007] Receiving a file download instruction sent by the shore server, the file download instruction including the storage path of the file on the ship-side industrial computer, the size of the file, the total number of file packages into which the file is divided, and the size of a single file package;
[0008] In response to the file download instruction, download the current file package according to a predetermined download strategy;
[0009] If the current file package is downloaded successfully, the current file package is saved to the storage path, and download success information is fed back to the shore server, so that the shore server sends the next file package after receiving the download success information;
[0010] If the current file package fails to be downloaded, the current file package is downloaded repeatedly until it is downloaded successfully;
[0011] During the downloading process of the current file package, the network speed between the ship-side industrial computer and the shore-side server is obtained, the predetermined download strategy is adjusted according to the network speed, a new download strategy is obtained, and the current file package is downloaded according to the new download strategy;
[0012] When the number of successfully downloaded file packages reaches the total number of packages, determining whether the size of the downloaded file is the same as the size of the file in the file download instruction;
[0013] If they are the same, the download is complete;
[0014] If they are not the same, delete the downloaded file and download it again until the download is complete.
[0015] By adopting the above technical solution, the ship-side industrial computer interacts with the shore-side server, and the shore-side server sends file download instructions to the ship-side industrial computer. At the same time, the ship-side industrial computer promptly feeds back to the shore-side server after downloading the part. During the download process, the ship-side industrial computer promptly self-checks the download result and network speed, and re-downloads when the download fails. When the network speed is poor, it adapts to the network conditions and adjusts the download strategy in time. Then, according to the new download strategy, the stability of the file downloaded by the ship-side industrial computer is adjusted, and the file update of the ship-side software is realized on the shore to ensure the integrity of the data.
[0016] Furthermore, the file download instruction also includes a sender MD5 check code. After the download is completed, the method further includes:
[0017] Calculate the receiver's MD5 checksum, and determine whether the sender's MD5 checksum is consistent with the receiver's MD5 checksum; if they are consistent, update the file to the storage path;
[0018] If they are inconsistent, delete the downloaded file and download it again until the sender's MD5 verification code is consistent with the receiver's MD5 verification code.
[0019] By adopting the above technical solution, after the download is completed, the integrity of the file is verified by the MD5 checksum to ensure that the file is not damaged during the transmission process.
[0020] Furthermore, if the network is interrupted, the predetermined download strategy is adjusted according to the network speed to obtain a new download strategy, including:
[0021] Determine the number of retries and the retry interval corresponding to the ship-side industrial computer according to the network speed;
[0022] Reconnecting to the shore server every retry interval to retry downloading the current file package;
[0023] When the number of retries to download the current file package reaches the number of retries, an error message is generated.
[0024] By adopting the above technical solution, after the network is interrupted, a new connection is established with the shore end immediately and the download is performed again. The number of retries and the retry interval are specified according to the network conditions to reduce unnecessary network expenses.
[0025] Furthermore, if the network is interrupted, the predetermined download strategy is adjusted according to the network speed to obtain a new download strategy, including:
[0026] Save the download progress of the current file package;
[0027] Reconnect to the shore server and continue downloading from the download progress.
[0028] By adopting the above technical solution, after the network is interrupted, the ship-side industrial computer can connect to the shore-side server again and continue to download files, thereby reducing the process of repeated file downloads and improving download efficiency.
[0029] Further, the adjusting the predetermined download strategy according to the network speed to obtain a new download strategy includes:
[0030] Get the current network speed and the historical network speed at the last moment;
[0031] Calculating a ratio of the current network speed to the historical network speed;
[0032] When obtaining the last moment, the ship-side industrial computer feeds back the historical interval time of the download success information to the shore-side server;
[0033] If the ratio is greater than or equal to 1, the quotient of the historical interval time and the ratio is used as the new interval time;
[0034] If the ratio is less than one, the quotient of the historical interval time and the ratio is taken as the first interval time, the ratio is compared with a preset table to determine the additional time, and the sum of the first interval time and the additional time is determined as the new interval time; wherein the preset table includes ratios of multiple ranges and the additional time corresponding to the ratio of each range;
[0035] If the number of times the same download success information is sent reaches a preset number, an error message is generated.
[0036] By adopting the above technical solution, the ship-side industrial computer compares the current network speed with the historical network speed, modifies the interval time according to the ratio, and through calculation rules and methods, can obtain the interval time for feedback of successful download information that is more suitable for the network conditions, reduce the frequency of sending message data, and reduce the occupancy of network bandwidth.
[0037] Further, the adjusting the predetermined download strategy according to the network speed to obtain a new download strategy includes:
[0038] Determine whether the number of bytes downloaded at a single time is compatible with the network speed; if compatible, do not modify the number of bytes downloaded at a single time;
[0039] If it does not match, the number of bytes downloaded at a single time is reduced.
[0040] By adopting the above technical solution, the ship-side industrial computer limits the download speed according to the network conditions to reduce the network bandwidth usage.
[0041] Further, the adjusting the predetermined download strategy according to the network speed to obtain a new download strategy includes:
[0042] Create multiple download threads;
[0043] Get the size of the current file package and create an empty file with the same size as the current file package;
[0044] Calculate the size of the sub-file package that each thread needs to download based on the size of the current file package and the number of download threads;
[0045] Determine the byte range corresponding to the sub-file package that each download thread needs to download in the empty file;
[0046] Each of the download threads downloads the corresponding sub-file packages simultaneously, writes the sub-file packages into the corresponding byte ranges in the empty file, and splices them together to obtain a complete current file package.
[0047] By adopting the above technical solution, multi-threaded downloading can divide the file package into multiple parts and download them simultaneously, effectively utilizing the broadband and increasing the download speed.
[0048] In the second aspect, the present application provides a ship-side software operation and maintenance device based on HTTP communication under restricted network conditions, which adopts the following technical solutions:
[0049] The instruction receiving module is used to receive the file download instruction sent by the shore server, wherein the file download instruction includes the storage path of the file in the ship-side industrial computer, the size of the file, the total number of file packages into which the file is divided, and the size of a single file package;
[0050] A response module, configured to respond to the file download instruction and download the current file package according to a predetermined download strategy;
[0051] A feedback module, for saving the current file package to the storage path after the download is successful, and feeding back download success information to the shore server, so that the shore server sends the next file package after receiving the download success information;
[0052] A repeated downloading module, used to repeatedly download the current file package after a download fails until the download succeeds;
[0053] A download strategy adjustment module, used to obtain the network speed between the ship-side industrial computer and the shore-side server during the download process of the current file package, adjust the predetermined download strategy according to the network speed, obtain a new download strategy, and download the current file package according to the new download strategy;
[0054] A checking module, used for judging whether the size of the downloaded file is the same as the size of the file in the file download instruction when the number of successfully downloaded file packages reaches the total number of packages;
[0055] If they are the same, the download is complete;
[0056] If they are not the same, delete the downloaded file and download it again until the download is complete.
[0057] By adopting the above technical solution, the ship-side industrial computer interacts with the shore-side server, and the shore-side server sends file download instructions to the ship-side industrial computer. At the same time, the ship-side industrial computer promptly feeds back to the shore-side server after downloading the part. During the download process, the ship-side industrial computer promptly self-checks the download result and network speed, and re-downloads when the download fails. When the network speed is poor, it adapts to the network conditions and adjusts the download strategy in time. Then, according to the new download strategy, the stability of the file downloaded by the ship-side industrial computer is adjusted, and the file update of the ship-side software is realized on the shore to ensure the integrity of the data.
[0058] In a third aspect, the present application provides an electronic device, which adopts the following technical solution:
[0059] An electronic device, comprising:
[0060] at least one processor;
[0061] Memory;
[0062] At least one computer program, wherein the at least one computer program is stored in the memory and configured to be executed by the at least one processor, the at least one computer program being configured to: execute the method as described in any one of the first aspects.
[0063] By adopting the above technical solution, the processor executes the computer program in the memory, so that the ship-side industrial computer interacts with the shore-side server. The shore-side server sends a file download instruction to the ship-side industrial computer. At the same time, the ship-side industrial computer promptly feeds back to the shore-side server after downloading the part. During the download process, the ship-side industrial computer promptly self-checks the download result and network speed, and re-downloads when the download fails. When the network speed is poor, it adapts to the network condition and adjusts the download strategy in time. Then, according to the new download strategy, the stability of the file downloaded by the ship-side industrial computer is adjusted, and the file update of the ship-side software is realized on the shore to ensure the integrity of the data.
[0064] In a fourth aspect, the present application provides a computer-readable storage medium, which adopts the following technical solution:
[0065] A computer-readable storage medium stores a computer program that can be loaded by a processor and executes the method as described in any one of the first aspects.
[0066] By adopting the above technical solution, the processor loads and executes the computer program in the computer-readable storage medium, so that the ship-side industrial computer interacts with the shore-side server. The shore-side server sends a file download instruction to the ship-side industrial computer. At the same time, the ship-side industrial computer promptly feeds back to the shore-side server after downloading the part. During the download process, the ship-side industrial computer promptly self-checks the download result and network speed, and re-downloads when the download fails. When the network speed is poor, it adapts to the network status and adjusts the download strategy in time. Then, according to the new download strategy, the stability of the file downloaded by the ship-side industrial computer is adjusted, and the file update of the ship-side software is realized on the shore to ensure the integrity of the data.
[0067] In summary, the present application includes at least one of the following beneficial technical effects:
[0068] 1. During the download process of the ship-side industrial computer, the ship-side industrial computer will self-check the download results and network speed in time, and re-download when the download fails. When the network speed is poor, it will adapt to the network conditions and adjust the download strategy in time. Then, according to the new download strategy, the stability of the file downloaded by the ship-side industrial computer is adjusted, and the file of the ship-side software is updated on the shore side to ensure the integrity of the data;
[0069] 2. After the network is interrupted, a new connection is established with the shore side as soon as possible, and the download is started again. The number of retries and the interval between retries are specified according to the network conditions to reduce unnecessary network expenses. After the ship-side industrial computer is connected to the shore-side server again, it continues to download files, reducing the process of repeated file downloads and improving download efficiency.
[0070] 3. Targetedly change the interval time for feedback of successful download information to be more suitable for network conditions, reduce the frequency of sending message data, and reduce the network bandwidth usage;
[0071] 4. The ship-side industrial computer limits the download speed according to the network conditions to reduce the network bandwidth usage;
[0072] 5. Multi-threaded downloading can divide the file package into multiple parts and download them simultaneously, effectively utilizing the bandwidth and increasing the download speed;
[0073] 6. After the download is complete, verify the integrity of the file using the MD5 checksum to ensure that the file has not been damaged during the transmission process. BRIEF DESCRIPTION OF THE DRAWINGS
[0074] Figure 1 It is a schematic diagram of the connection between the ship-side industrial computer and the shore-side server in an embodiment of the present application.
[0075] Figure 2 It is a flowchart of a method for operating and maintaining ship-side software based on HTTP communication under restricted network conditions in an embodiment of the present application.
[0076] Figure 3 It is a structural block diagram of a ship-side software operation and maintenance device based on HTTP communication under restricted network conditions in an embodiment of the present application.
[0077] Figure 4 It is a structural block diagram of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0078] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0079] In addition, the term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article, unless otherwise specified, generally means that the associated objects before and after are in an "or" relationship.
[0080] The embodiment of the present application discloses a ship-side software operation and maintenance method based on HTTP communication under restricted network conditions, which is executed by a ship-side industrial control computer. The ship-side industrial control computer can be a server or a terminal device, wherein the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. The terminal device can be a smart phone, a tablet computer, a desktop computer, etc., but is not limited thereto. Figure 1and Figure 2 , including (step S101 to step S111):
[0081] Step S101: receiving a file download instruction sent by a shore server, the file download instruction including the storage path of the file in the ship-side industrial computer, the size of the file, the total number of file packages into which the file is divided, the size of a single file package and the current file package.
[0082] Specifically, the method provided in this application is used for both Windows and Linux. When the ship-side software needs to be updated, the shore-side server sends a message to download the file to the ship-side industrial computer through the shore-side operation and maintenance software, that is, sends a file download instruction. The file download instruction is to inform the ship-side industrial computer of the storage path, file size, the total number of file packages divided during the file transfer process, and the size of a single file package of the file on the ship. After the ship-side industrial computer obtains the relevant information, it is prepared for subsequent file downloads.
[0083] Step S102: In response to the file download instruction, the current file package is downloaded according to a predetermined download strategy.
[0084] Specifically, after receiving the file download instruction, the ship-side operation and maintenance software on the ship-side industrial computer needs to find the corresponding storage path on the ship-side industrial computer and create an empty folder that can accommodate files at the storage path location. Then, the ship-side industrial computer responds to the file download instruction and starts downloading files.
[0085] Since the file is divided into multiple file packages, the ship-side industrial computer starts to download the first file package, wherein the predetermined download strategy includes a predetermined number of bytes for a single download.
[0086] Step S103: If the current file package is downloaded successfully, the current file package is saved to the storage path, and the download success information is fed back to the shore server, so that the shore server sends the next file package after receiving the download success information.
[0087] Specifically, if no error occurs during the download of the file package, and the size of the current file package being downloaded is the same as the size of a single file package in the file download instruction, the ship-side industrial computer determines that the download is successful.
[0088] After the current file package is downloaded successfully, the current file is saved to an empty folder established in the storage path, and then the download success information is fed back to the security server. After the shore server receives the download success information, it will know that the previous file package has been downloaded successfully, and then send the next file package, transmitting files in an orderly manner to avoid file package transmission loss in the case of poor network conditions and ensure file integrity.
[0089] Step S104: If the download of the current file package fails, the current file package is downloaded repeatedly until the download is successful.
[0090] Specifically, if an error occurs in the ship-side industrial computer during the download of the current file package, or the size of the current file package after downloading is inconsistent with the size of a single file package, it can be determined that the download has failed. When the download fails, the ship-side industrial computer can re-download the current file package.
[0091] If the number of failed downloads of the same file package reaches a preset value, it may be caused by network reasons, and step S105 can be executed.
[0092] Step S105: During the download process of the current file package, the network speed between the ship-side industrial computer and the shore-side server is obtained, the predetermined download strategy is adjusted according to the network speed, a new download strategy is obtained, and the current file package is downloaded according to the new download strategy.
[0093] Specifically, when the ship-side industrial computer is downloading the file package, the network speed is obtained in real time. When the network speed is not ideal, the download strategy is adjusted in time to facilitate smooth transmission of the file.
[0094] Generally, in order to ensure that the shore server can obtain the download success information, the ship-side industrial computer sends it repeatedly at intervals. When the network speed changes, the speed at which the ship-side industrial computer feeds back the download success information to the shore server will also change. Therefore, the interval of the feedback information can be adjusted. Step S105 includes (steps S11 to S16):
[0095] Step S11: Obtain the current network speed and the historical network speed at the last moment.
[0096] Specifically, the ship-side industrial computer detects the network speed once every other time. Therefore, the time interval between the current network speed and the previous time is a preset time period. Therefore, the network speed can be monitored in real time and targeted improvements can be made.
[0097] Step S12: Calculate the ratio of the current network speed to the historical network speed.
[0098] Step S13: When obtaining the last moment, the ship-side industrial computer feeds back the historical interval time of the download success information to the shore-side server.
[0099] Step S14: If the ratio is greater than or equal to 1, the quotient of the historical interval time and the ratio is used as the new interval time.
[0100] Specifically, if the ratio is equal to one, the current network speed is equal to the historical network speed, and the interval time can remain unchanged; if the ratio is greater than one, the current network speed is increased, and the interval time can be reduced, so that the shore server can send subsequent messages as soon as possible, speeding up the file transfer speed. Therefore, the historical interval time is divided by the ratio, and the calculated quotient is smaller than the historical time interval, that is, the new interval time.
[0101] Step S15: If the ratio is less than one, the quotient of the historical interval time and the ratio is taken as the first interval time, the ratio is compared with the preset table, the additional time is determined, and the sum of the first interval time and the additional time is determined as the new interval time; wherein the preset table includes ratios of multiple ranges and the additional time corresponding to the ratio of each range.
[0102] Specifically, if the ratio is less than one, the current network speed slows down, and the interval time can be increased to extend the message reply time. Therefore, the ship-side industrial computer divides the historical interval time by the ratio to obtain a first interval time that is larger than the historical interval time. Because the data transmission speed is more uncontrollable when the network speed is slow, the actual transmission speed is not necessarily proportional to the network speed. Therefore, the ship-side industrial computer determines the additional time according to the ratio, and adds the additional time to the first interval time to obtain a new interval time, so as to reduce the frequency of sending message data and reduce the occupation of network bandwidth.
[0103] Step S16: If the number of times the same download success message is sent reaches a preset number, an error message is generated.
[0104] Under normal circumstances, the download success information sent by the ship-side industrial computer is adapted to the network speed. Within the preset number of times, the shore-side server can receive the information. Therefore, if the number of times the ship-side industrial computer sends the download success information reaches the preset number, it can be reflected that there is an abnormality in the network connection between the ship-side industrial computer and the shore-side server, and an error message is generated, and the ship-side staff will find the specific cause.
[0105] In another case, the number of bytes downloaded by the ship-side industrial computer at a time is predetermined, but under the condition of poor network, the ship-side industrial computer can limit the download speed to reduce the network bandwidth usage. Specifically, step S105 also includes (steps S21 to S23):
[0106] Step S21: determine whether the number of bytes downloaded at a single time is compatible with the network speed; if it is compatible, execute step S22: do not modify the number of bytes downloaded at a single time;
[0107] If not, execute step S23: reduce the number of bytes downloaded at a time.
[0108] Specifically, the ship-side industrial computer presets multiple ranges of single download byte number ranges that are compatible with the network speed. The ship-side industrial computer obtains the single download byte number range that is compatible with the network speed, and then compares the current single download byte with the single download byte number range. If it is within the range, it is determined to be compatible and the single download byte number is not modified; if the single download byte is less than the corresponding range, it is not compatible, and the single download byte number is reduced.
[0109] Furthermore, in order to effectively utilize broadband, the ship-side industrial computer can download in multiple threads. Multi-threaded downloading can divide the file into multiple parts, and each part is downloaded simultaneously by a different thread, which can significantly improve the download speed when the server and network environment allow parallel transmission.
[0110] Furthermore, step S105 further includes (steps S31 to S35):
[0111] Step S31: Establish multiple download threads.
[0112] Step S32: Obtain the size of the current file package and create an empty file with the same size as the current file package.
[0113] Step S33: Calculate the size of the sub-file package that each thread needs to download according to the size of the current file package and the number of download threads.
[0114] Specifically, the size of the sub-file package that each thread needs to download can be calculated by dividing the size of the current file package by the number of download threads.
[0115] Step S34: Determine the byte range in the empty file corresponding to the sub-file package that each download thread needs to download.
[0116] Step S35: Each download thread simultaneously downloads the corresponding sub-file package, writes the sub-file package into the corresponding byte range in the empty file, and splices them together to obtain a complete current file package.
[0117] Specifically, the ship-side industrial control computer predetermines the byte range of the sub-file package in the empty file, so that when multiple threads are downloading simultaneously, the sub-file package can be written into the corresponding position, thereby ensuring that a complete current file package is obtained after splicing.
[0118] Furthermore, in the case of a poor network, a network interruption may also occur. When a network interruption occurs, it is necessary to process the downloaded files and subsequent downloading steps in a timely manner. Then step S105 further includes (steps S41 to S43):
[0119] Step S41: Determine the number of retries and the retry interval corresponding to the ship-side industrial computer according to the network speed.
[0120] Specifically, the number of retries is the number of times the ship-side industrial computer re-downloads after the network is interrupted, and the retry interval is the interval time between retries when no result is obtained.
[0121] Step S42: Reconnect to the shore server at every retry interval and retry downloading the current file package.
[0122] Step S43: When the number of retries to download the current file package reaches the retry number, an error message is generated.
[0123] Specifically, when the network is interrupted, the ship-side industrial computer immediately establishes a new connection with the shore-side server and re-downloads the current file package. When the number of retries is reached, the current network status is abnormal, which also reduces unnecessary network expenses and prompts the staff to check.
[0124] In another possibility, a network interruption may cause a download interruption. In order to reduce the download amount, the industrial computer on the ship performs breakpoint resumption to reduce the repeated downloading of files and improve the download efficiency. That is, step S105 also includes: saving the download progress of the current file package; reconnecting to the shore server and continuing the download from the download progress.
[0125] Step S106: When the number of successfully downloaded file packages reaches the total number of packages, determine whether the size of the downloaded file is the same as the size of the file in the file download instruction; if the same, execute step S107: download completed; if not the same, execute step S108: delete the downloaded file and download it again until the download is completed.
[0126] Specifically, every time a file package is downloaded, the ship-side industrial computer records the number of file packages plus one. When the number of file packages reaches the total number of packages, the size of the downloaded file is compared with the file size in the file download instruction. If they are the same, the downloaded file is complete and intact; if they are different, there is an error in the download process and the local file has an error, so it needs to be downloaded again.
[0127] Furthermore, the ship-side industrial computer can also confirm whether the received file content is consistent with the original file according to MD5, and the file download instruction sent by the shore-side server includes the sender's MD5 verification code. When the download is completed, the above method also includes:
[0128] Step S109: Calculate the MD5 checksum of the receiver, and if the MD5 checksum of the sender is consistent with the MD5 checksum of the receiver, execute step S110: update the file to the storage path;
[0129] If they are inconsistent, step S111 is executed: deleting the downloaded file and downloading it again until the MD5 verification code of the sender is consistent with the MD5 verification code of the receiver.
[0130] Specifically, since the MD5 checksum is calculated through the file according to the preset rules, if there is a slight difference in the file, the generated MD5 checksum will be completely different. Therefore, after comparing the file size, the ship-side industrial computer calculates the MD5 checksum of the receiver according to the local file and the preset rules, and compares the calculation result with the MD5 checksum of the sender. If the comparison is consistent, it can be determined that the file size and content are the same as the original file, and the file is automatically updated again, and refreshed and saved to the storage path; if the comparison is inconsistent, there is an error in the download, and the downloaded error file needs to be deleted and downloaded again.
[0131] Therefore, the present application obtains the network connection status between the ship-side industrial computer and the shore-side server by real-time monitoring of the network speed, and adjusts the download strategy of the ship-side industrial computer in time when the network connection is poor.
[0132] For example, the time for feedback of download success information is extended, the frequency is reduced, and the network bandwidth is reduced; the download speed is limited to avoid connection interruption due to excessive bandwidth consumption; the download speed can be improved to a certain extent by downloading different parts of the file through multi-threading; when the network is interrupted, the download is automatically retried, and the number of retries and retry intervals are changed according to the network conditions; when the network is interrupted, the breakpoint is resumed. Therefore, under the first network conditions, the stability of data transmission between the ship and the shore is improved.
[0133] In order to better implement the above method, the embodiment of the present application also provides a ship-side software operation and maintenance device based on HTTP communication under restricted network conditions, referring to Figure 3 The ship-side software operation and maintenance device 200 based on HTTP communication under restricted network conditions includes:
[0134] The instruction receiving module 201 is used to receive a file download instruction sent by the shore server, the file download instruction includes the storage path of the file in the ship-side industrial computer, the size of the file, the total number of file packages into which the file is divided, and the size of a single file package;
[0135] A response module 202, configured to respond to a file download instruction and download the current file package according to a predetermined download strategy;
[0136] Feedback module 203, used for saving the current file package to the storage path after the download is successful, and feeding back the download success information to the shore server, so that the shore server sends the next file package after receiving the download success information;
[0137] Repeat download module 204, used to repeatedly download the current file package after download failure until the download is successful;
[0138] The download strategy adjustment module 205 is used to obtain the network speed between the ship-side industrial computer and the shore-side server during the download process of the current file package, adjust the predetermined download strategy according to the network speed, obtain a new download strategy, and download the current file package according to the new download strategy;
[0139] A checking module 206, for determining whether the size of the downloaded file is the same as the size of the file in the file download instruction when the number of successfully downloaded file packages reaches the total number of packages;
[0140] If they are the same, the download is complete;
[0141] If they are not the same, delete the downloaded file and download it again until the download is complete.
[0142] Furthermore, the ship-side software operation and maintenance device 200 based on HTTP communication under restricted network conditions also includes an MD5 verification module 207 for:
[0143] Calculate the receiver's MD5 checksum and determine whether the sender's MD5 checksum is consistent with the receiver's MD5 checksum; if they are consistent, update the file to the storage path;
[0144] If they are inconsistent, delete the downloaded file and download it again until the sender's MD5 verification code is consistent with the receiver's MD5 verification code.
[0145] Furthermore, when the network is interrupted, the download strategy adjustment module 205 is specifically used to:
[0146] Determine the number of retries and retry intervals corresponding to the ship-side industrial computer according to the network speed;
[0147] Reconnect to the shore server at every retry interval and retry downloading the current file package;
[0148] When the number of retries to download the current file package reaches the retry count, an error message is generated.
[0149] Furthermore, when the network is interrupted, the download strategy adjustment module 205 is specifically used to:
[0150] Save the download progress of the current file package;
[0151] Reconnect to the shore server and continue downloading from the download progress.
[0152] Furthermore, the download strategy adjustment module 205 is specifically used for:
[0153] Get the current network speed and the historical network speed at the last moment;
[0154] Calculate the ratio of current network speed to historical network speed;
[0155] When obtaining the last moment, the ship-side industrial computer feeds back the historical interval of download success information to the shore-side server;
[0156] If the ratio is greater than or equal to one, the quotient of the historical interval time and the ratio is taken as the new interval time;
[0157] If the ratio is less than one, the quotient of the historical interval time and the ratio is taken as the first interval time, the ratio is compared with a preset table to determine the additional time, and the sum of the first interval time and the additional time is determined as the new interval time; wherein the preset table includes ratios of multiple ranges and the additional time corresponding to the ratio of each range;
[0158] If the number of times the same download success message is sent reaches a preset number, an error message is generated.
[0159] Furthermore, the download strategy adjustment module 205 is specifically used for:
[0160] Determine whether the number of bytes downloaded at a time is compatible with the network speed; if so, do not modify the number of bytes downloaded at a time;
[0161] If it does not match, reduce the number of bytes downloaded at a time.
[0162] Furthermore, the download strategy adjustment module 205 is specifically used for:
[0163] Create multiple download threads;
[0164] Get the size of the current file package and create an empty file with the same size as the current file package;
[0165] Calculate the size of the sub-file package that each thread needs to download based on the size of the current file package and the number of download threads;
[0166] Determine the byte range corresponding to the sub-file package that each download thread needs to download in the empty file;
[0167] Each download thread downloads the corresponding sub-file package at the same time, writes the sub-file package into the corresponding byte range in the empty file, and splices them together to obtain the complete current file package.
[0168] The various variations and specific examples of the methods in the aforementioned embodiments are also applicable to the ship-side software operation and maintenance device based on HTTP communication under restricted network conditions in this embodiment. Through the aforementioned detailed description of the ship-side software operation and maintenance method based on HTTP communication under restricted network conditions, those skilled in the art can clearly know the implementation method of the ship-side software operation and maintenance device based on HTTP communication under restricted network conditions in this embodiment. Therefore, for the sake of brevity of the specification, it will not be described in detail here.
[0169] In order to better implement the above method, the present application embodiment provides an electronic device, referring to Figure 4 , the electronic device 300 includes: a processor 301, a memory 303 and a display screen 305. Among them, the memory 303 and the display screen 305 are connected to the processor 301, such as through a bus 302. Optionally, the electronic device 300 may also include a transceiver 304. It should be noted that in actual applications, the transceiver 304 is not limited to one, and the structure of the electronic device 300 does not constitute a limitation on the embodiments of the present application.
[0170] The processor 301 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. The processor 301 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.
[0171] The bus 302 may include a path to transmit information between the above components. The bus 302 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The bus 302 may be divided into an address bus, a data bus, a control bus, etc.
[0172] The memory 303 may be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto.
[0173] The memory 303 is used to store the application code for executing the solution of the present application, and the execution is controlled by the processor 301. The processor 301 is used to execute the application code stored in the memory 303 to implement the contents shown in the above method embodiment.
[0174] Figure 4 The electronic device 300 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0175] The embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. When the program is executed by the processor, the ship-side software operation and maintenance method based on HTTP communication under restricted network conditions provided by the above embodiment is implemented. The processor loads and executes the computer program in the computer-readable storage medium, so that the ship-side industrial computer interacts with the shore-side server. The shore-side server sends a file download instruction to the ship-side industrial computer. At the same time, the ship-side industrial computer promptly feeds back to the shore-side server after downloading the part. During the download process, the ship-side industrial computer promptly self-checks the download result and network speed, and re-downloads when the download fails. When the network speed is poor, it adapts to the network condition and adjusts the download strategy in time, and then adjusts the stability of the downloaded files by the ship-side industrial computer according to the new download strategy, and implements the file update of the ship-side software on the shore to ensure the integrity of the data.
[0176] In this embodiment, the computer-readable storage medium may be a tangible device that holds and stores instructions used by the instruction execution device. The computer-readable storage medium may be, but is not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any combination thereof. Specifically, the computer-readable storage medium may be a portable computer disk, a hard disk, a USB flash drive, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a podium random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, an optical disk, a magnetic disk, a mechanical encoding device, and any combination thereof.
[0177] The computer program in this embodiment includes program codes for executing all the aforementioned methods, and the program codes may include instructions corresponding to the steps of the methods provided in the above embodiments. The computer program can be downloaded from a computer-readable storage medium to various computing / processing devices, or downloaded to an external computer or external storage device via a network (such as the Internet, a local area network, a wide area network, and / or a wireless network). The computer program can be executed completely on the user's computer or as an independent software package.
[0178] The above are all preferred embodiments of the present application, and the protection scope of the present application is not limited thereto. Therefore, any equivalent changes made according to the structure, shape, and principle of the present application should be included in the protection scope of the present application.
[0179] In addition, it is to be understood that relational terms such as first and second are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. The terms "comprises," "comprising," or any other variation thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device that includes a series of elements includes not only those elements, but also other elements that are not explicitly listed, or elements that are inherent to such process, method, article, or device.
Claims
1. A method for operating and maintaining ship-side software based on HTTP communication under restricted network conditions, characterized in that: Executed by the ship-side industrial computer, including: Receiving a file download instruction sent by the shore server, the file download instruction including the storage path of the file on the ship-side industrial computer, the size of the file, the total number of file packages into which the file is divided, and the size of a single file package; In response to the file download instruction, download the current file package according to a predetermined download strategy; If the current file package is downloaded successfully, the current file package is saved to the storage path, and download success information is fed back to the shore server, so that the shore server sends the next file package after receiving the download success information; If the current file package fails to be downloaded, the current file package is downloaded repeatedly until it is downloaded successfully; During the downloading process of the current file package, the network speed between the ship-side industrial computer and the shore-side server is obtained, the predetermined download strategy is adjusted according to the network speed, a new download strategy is obtained, and the current file package is downloaded according to the new download strategy; When the number of successfully downloaded file packages reaches the total number of packages, determining whether the size of the downloaded file is the same as the size of the file in the file download instruction; If they are the same, the download is complete; If they are not the same, the downloaded file is deleted and downloaded again until the download is complete; If the network is interrupted, adjusting the predetermined download strategy according to the network speed to obtain a new download strategy includes: Determine the number of retries and the retry interval corresponding to the ship-side industrial computer according to the network speed; Reconnecting to the shore server every retry interval to retry downloading the current file package; When the number of retries to download the current file package reaches the number of retries, an error message is generated; The step of adjusting the predetermined download strategy according to the network speed to obtain a new download strategy includes: Get the current network speed and the historical network speed at the last moment; Calculating a ratio of the current network speed to the historical network speed; When obtaining the last moment, the ship-side industrial computer feeds back the historical interval time of the download success information to the shore-side server; If the ratio is greater than or equal to 1, the quotient of the historical interval time and the ratio is used as the new interval time; If the ratio is less than one, the quotient of the historical interval time and the ratio is taken as the first interval time, the ratio is compared with a preset table to determine the additional time, and the sum of the first interval time and the additional time is determined as the new interval time; wherein the preset table includes ratios of multiple ranges and the additional time corresponding to the ratio of each range; If the number of times the same download success information is sent reaches a preset number, an error message is generated.
2. The method according to claim 1, characterized in that The file download instruction also includes a sender MD5 verification code. After the download is completed, the method further includes: Calculate the receiver's MD5 checksum, and determine whether the sender's MD5 checksum is consistent with the receiver's MD5 checksum; if they are consistent, update the file to the storage path; If they are inconsistent, delete the downloaded file and download it again until the sender's MD5 verification code is consistent with the receiver's MD5 verification code.
3. The method according to claim 1, characterized in that If the network is interrupted, adjusting the predetermined download strategy according to the network speed to obtain a new download strategy includes: Save the download progress of the current file package; Reconnect to the shore server and continue downloading from the download progress.
4. The method according to claim 1, characterized in that: The step of adjusting the predetermined download strategy according to the network speed to obtain a new download strategy includes: Determine whether the number of bytes downloaded at a single time is compatible with the network speed; if compatible, do not modify the number of bytes downloaded at a single time; If it does not match, the number of bytes downloaded at a single time is reduced.
5. The method according to claim 1, characterized in that: The step of adjusting the predetermined download strategy according to the network speed to obtain a new download strategy includes: Create multiple download threads; Get the size of the current file package and create an empty file with the same size as the current file package; Calculate the size of the sub-file package that each thread needs to download based on the size of the current file package and the number of download threads; Determine the byte range corresponding to the sub-file package that each download thread needs to download in the empty file; Each of the download threads downloads the corresponding sub-file packages simultaneously, writes the sub-file packages into the corresponding byte ranges in the empty file, and splices them together to obtain a complete current file package.
6. A ship-side software operation and maintenance device based on HTTP communication under restricted network conditions, characterized in that: include: The instruction receiving module is used to receive a file download instruction sent by the shore server, wherein the file download instruction includes the storage path of the file on the ship-side industrial computer, the size of the file, the total number of file packages into which the file is divided, and the size of a single file package; A response module, configured to respond to the file download instruction and download the current file package according to a predetermined download strategy; A feedback module, for saving the current file package to the storage path after the download is successful, and feeding back download success information to the shore server, so that the shore server sends the next file package after receiving the download success information; A repeated downloading module, used to repeatedly download the current file package after a download fails until the download succeeds; A download strategy adjustment module, used to obtain the network speed between the ship-side industrial computer and the shore-side server during the download process of the current file package, adjust the predetermined download strategy according to the network speed, obtain a new download strategy, and download the current file package according to the new download strategy; A checking module, used for judging whether the size of the downloaded file is the same as the size of the file in the file download instruction when the number of successfully downloaded file packages reaches the total number of packages; If they are the same, the download is complete; If they are not the same, the downloaded file is deleted and downloaded again until the download is complete; When the network is interrupted, the download strategy adjustment module is specifically used to: Determine the number of retries and retry intervals corresponding to the ship-side industrial computer according to the network speed; Reconnect to the shore server at every retry interval and retry downloading the current file package; When the number of retries to download the current file package reaches the retry count, an error message is generated; The download strategy adjustment module is specifically used for: Get the current network speed and the historical network speed at the last moment; Calculate the ratio of current network speed to historical network speed; When obtaining the last moment, the ship-side industrial computer feeds back the historical interval of download success information to the shore-side server; If the ratio is greater than or equal to one, the quotient of the historical interval time and the ratio is taken as the new interval time; If the ratio is less than one, the quotient of the historical interval time and the ratio is taken as the first interval time, the ratio is compared with a preset table to determine the additional time, and the sum of the first interval time and the additional time is determined as the new interval time; wherein the preset table includes ratios of multiple ranges and the additional time corresponding to the ratio of each range; If the number of times the same download success message is sent reaches a preset number, an error message is generated.
7. An electronic device, characterized in that: include: at least one processor; Memory; At least one computer program, wherein the at least one computer program is stored in the memory and configured to be executed by the at least one processor, the at least one computer program being configured to: execute the method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that: A computer program is stored which can be loaded by a processor and execute the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Ship-shore communication method and system in ship management system
CN114584575A