File transmission method, device, system and electronic equipment

By introducing a relay server in the server cluster to convert and transfer files, the port restrictions and security issues caused by FTP or SFTP transmission are solved, and the security and controllability of file transmission are achieved.

CN115348258BActive Publication Date: 2024-10-11CHINA CONSTR BANK CORP GUIZHOU BRANCH
View PDF 10 Cites 0 Cited by

Patent Information

Application Number
CN202210987461.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-17
Publication Date
2024-10-11
Estimated Expiration
2042-08-17

AI Technical Summary

Technical Problem

In a server cluster environment, when using FTP or SFTP for file transfer, it is easy to exceed the port number limit, which causes a heavy network burden and is not conducive to security. Especially in active mode or passive mode, random ports will be generated, affecting the security of file services. sex.

Method used

For file transfer through the transfer server, the file to be transferred is first stored in the temporary folder of the transfer server, and the request message is converted into a predetermined format message. Based on the format, the consumer or caller server information is determined, and the file is transferred from The server transfers to the specified folder, avoiding the direct use of FTP or SFTP protocols to achieve network isolation between the file provider and the file acquirer.

Benefits of technology

It effectively avoids the flow of FTP or SFTP protocols in the server cluster, reduces the generation of random ports, improves the controllability of network management and enhances the security of file transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115348258B_ABST
    Figure CN115348258B_ABST
Patent Text Reader

Abstract

The present application discloses a file transmission method, device, system and electronic device. When transmitting a file to be transmitted, the file to be transmitted is stored through a transit server, and the file to be transmitted stored in the transit server is output to other servers, and a request message is converted into a message in a predetermined format, and the message protocol is unified through the transit server to avoid the FTP or SFTP protocol from circulating in a server cluster. The network isolation between the file provider network, the transit network and the file acquirer network is achieved through the transit server, thereby ensuring the security of the file transmission process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of file transmission, and in particular to a file transmission method, device, system and electronic equipment. Background Art

[0002] When transferring files, FTP or SFTP is usually used to transfer files point-to-point using designated ports. This method of transferring files is prone to exceeding the port number limit, especially in a cluster environment. Some random ports will be generated in both active and passive modes, which places a heavy burden on network management and control and is not conducive to the secure provision of file services. Summary of the invention

[0003] In view of this, the present application provides a file transmission method, device, system and electronic device, and its specific solutions are as follows:

[0004] A file transmission method, comprising:

[0005] Obtaining a file to be transmitted, and storing the file to be transmitted in a temporary folder of the transfer server;

[0006] Obtaining a request message, and converting the request message into a message in a predetermined format adapted to the transit server;

[0007] Determine, based on the message in the predetermined format, information of a consumer server or information of a caller server for receiving the file to be transmitted specified by the message in the predetermined format;

[0008] Based on the consumer server information or the caller server information, the to-be-transmitted file stored in the temporary folder of the transit server is transmitted to a designated folder of the consumer server or the caller server for storage.

[0009] Further, the obtaining of the file to be transmitted and storing the file to be transmitted in a temporary folder of the transit server includes:

[0010] Obtaining a first file to be transmitted through a first transmission mode;

[0011] Determining whether the transfer server includes a first file storage path of a first file to be transferred;

[0012] If the transfer server includes a first file storage path of the first file to be transferred, storing the first file to be transferred in a first temporary folder specified by the first file storage path in the transfer server;

[0013] If the transfer server does not include the first file storage path of the first file to be transmitted, create a second temporary folder that matches the first file storage path of the first file to be transmitted, and store the first file to be transmitted in the second temporary folder.

[0014] Further, the obtaining of the file to be transmitted and storing the file to be transmitted in a temporary folder of the transit server includes:

[0015] Obtaining a second file to be transmitted through a second transmission mode;

[0016] Encrypting the file stream of the second file to be transmitted to obtain an encrypted file stream;

[0017] The number of bytes of the file stream of the second file to be transmitted is obtained, and the number of bytes is combined with the encrypted file stream and stored in a third temporary folder of the transit server.

[0018] Further, the transferring of the to-be-transmitted file stored in the temporary folder of the transit server to a designated folder of the consumer server or the caller server for storage based on the consumer server information or the caller server information includes:

[0019] Determining whether the consumer server includes a second file storage path for storing a third file to be transmitted specified by the predetermined format message;

[0020] If it is determined that the second file storage path is not included in the consumer server, a fourth temporary folder that conforms to the second file storage path is created, and the third file to be transmitted stored in the transit server is sent to the consumer server so that the third file to be transmitted can be stored in the fourth temporary folder.

[0021] Furthermore, it also includes:

[0022] A return result sent by the consumer server is obtained, where the return result is used to indicate that the third file to be transmitted is stored in the fourth temporary folder.

[0023] Further, the obtaining of the file to be transmitted and storing the file to be transmitted in a temporary folder of the transit server includes:

[0024] Get a file download request;

[0025] Determining, based on the file download request, that the file to be downloaded is stored in the first consumer server;

[0026] Determine that the connection mode between the transit server and the first consumer server is a first connection mode, and obtain and store the file to be downloaded from the first consumer server based on the first connection mode.

[0027] Further, the transferring of the to-be-transmitted file stored in the temporary folder of the transit server to a designated folder of the consumer server or the caller server based on the consumer server information or the caller server comprises:

[0028] Obtaining the message information of the calling server information;

[0029] Determine a transmission mode of transmitting the file to be downloaded based on the message information of the calling server information;

[0030] The file to be downloaded is sent to the calling server through the determined transmission mode, so that the calling server stores the file to be downloaded based on the transmission mode.

[0031] A file transmission device, comprising:

[0032] A first obtaining unit, configured to obtain a file to be transmitted, and store the file to be transmitted in a temporary folder of the transit server;

[0033] A second obtaining unit, configured to obtain a request message, and convert the request message into a message in a predetermined format adapted to the transit server;

[0034] A determining unit, configured to determine, based on the message in the predetermined format, information about a consumer server or a caller server for receiving the file to be transmitted specified by the message in the predetermined format;

[0035] The storage unit is used to transfer the to-be-transmitted files stored in the temporary folder of the transit server to the designated folder of the consumer server or the caller server for storage based on the consumer server information or the caller server information.

[0036] An electronic device, comprising:

[0037] A processor, configured to obtain a file to be transmitted, and store the file to be transmitted in a temporary folder of a transit server; obtain a request message, and convert the request message into a message in a predetermined format adapted to the transit server; determine, based on the message in the predetermined format, consumer server information or caller server information for receiving the file to be transmitted specified by the message in the predetermined format; and transfer the file to be transmitted stored in the temporary folder of the transit server to a designated folder of the consumer server or the caller server for storage based on the consumer server information or the caller server information;

[0038] The memory is used to store the program for the processor to execute the above processing process.

[0039] A file transmission system, comprising:

[0040] The calling server is used to send the file to be transmitted to the transit server, and / or obtain and store the file to be transmitted from the transit server;

[0041] The transit server is used to obtain the file to be transmitted sent by the calling server or the consumer server, and store the file to be transmitted in a temporary folder; obtain the request message sent by the consumer server or the calling server, convert the request message into a predetermined format message adapted to the transit server, determine the consumer server information or the calling server information for receiving the file to be transmitted specified by the predetermined format message based on the predetermined format message, and transmit the file to be transmitted stored in the temporary folder to the designated folder of the consumer server or the calling server based on the consumer server information or the calling server information for storage;

[0042] The consumer server is used to obtain and store the files to be transmitted sent by the transit server, and / or send the files to be transmitted stored in the designated folder of the consumer server to the transit server.

[0043] It can be seen from the above technical scheme that the file transmission method, device, system and electronic device disclosed in the present application obtain the file to be transmitted, store the file to be transmitted in a temporary folder of the transit server; obtain a request message, convert the request message into a predetermined format message adapted to the transit server, determine the consumer server information or caller server information for receiving the file to be transmitted specified by the predetermined format message based on the predetermined format message, and transfer the file to be transmitted stored in the temporary folder of the transit server to the designated folder of the consumer server or the caller server based on the consumer server information or the caller server information for storage. In this scheme, when transmitting the file to be transmitted, the transit server is used to store the file to be transmitted, and the file to be transmitted stored in the transit server is output to other servers, and the request message is converted into a predetermined format message, and the message protocol is unified through the transit server to avoid the FTP or SFTP protocol from circulating in the server cluster, and the network isolation between the file provider network, the transit network and the file acquirer network is realized through the transit server, thereby ensuring the security of the file transmission process. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0045] Figure 1 A flowchart of a file transmission method disclosed in an embodiment of the present application;

[0046] Figure 2 A flowchart of a file transmission method disclosed in an embodiment of the present application;

[0047] Figure 3 A schematic diagram of a file transfer system working scenario disclosed in an embodiment of the present application;

[0048] Figure 4 A flowchart of a file transmission method disclosed in an embodiment of the present application;

[0049] Figure 5 A schematic diagram of the structure of a file transmission device disclosed in an embodiment of the present application;

[0050] Figure 6 A schematic diagram of the structure of an electronic device disclosed in an embodiment of the present application;

[0051] Figure 7 A schematic diagram of the structure of a file transfer system disclosed in an embodiment of the present application. DETAILED DESCRIPTION

[0052] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only 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.

[0053] The present application discloses a file transmission method, and its flow chart is as follows: Figure 1 As shown, including:

[0054] Step S11, obtaining the file to be transmitted, and storing the file to be transmitted in a temporary folder of the transfer server;

[0055] Step S12: obtaining a request message, and converting the request message into a message in a predetermined format adapted to the transit server;

[0056] Step S13: determining, based on the message in the predetermined format, information of a consumer server or information of a caller server for receiving the file to be transmitted specified by the message in the predetermined format;

[0057] Step S14: Based on the information of the consumer server or the caller server, the to-be-transmitted file stored in the temporary folder of the transit server is transferred to the designated folder of the consumer server or the caller server for storage.

[0058] Currently, FTP or SFTP is usually used for point-to-point designated port transmission when transferring files. This method of file transfer is prone to exceeding the port number limit, especially in a server cluster environment. Whether in active or passive mode, some random ports will be generated, which imposes a heavy burden on network management and control. At the same time, it is easy to expose multiple ports, which is not conducive to the safe provision of file services.

[0059] Based on this, this solution proposes a file proxy service that supports FTP, SFTP and Fsever to achieve seamless file transfer.

[0060] Specifically, in this solution, when there are files to be transmitted, the files to be transmitted are stored in the transit server so as to facilitate the transit through the transit server, thereby avoiding direct contact between the file sender and the file receiver, and realizing network isolation between the file sender and the file receiver through the transit server.

[0061] The file sender may be a consumer server, that is, a consumer of the file service, or a caller server, that is, a provider of the file service.

[0062] Whether it is the consumer server or the caller server, after the file to be transferred is output, the file to be transferred is first sent to the transit server. The transit server obtains the file to be transferred and stores it in the corresponding temporary folder so that the stored file to be transferred can be sent out based on the message obtained from other servers.

[0063] When the transit server obtains a request message, the request message it obtains is a message of the FTP or SFTP protocol. In order to eliminate the circulation of FTP and SFTP protocols in the cluster, the transit server will perform message adaptation on all the messages obtained, and convert all the messages obtained into messages in a predetermined format adapted to the transit server, that is, convert them into a custom message format for data flow interaction.

[0064] That is, after the message is converted into a message in a predetermined format, the subsequent data interaction based on the message also adopts the message in the predetermined format, thereby achieving the purpose of avoiding the use of FTP or SFTP protocols, and avoiding the problem of generating random ports according to the protocol when directly using FTP or SFTP to communicate in the cluster, which is not conducive to management and control; the port generated by the protocol corresponding to the message in the predetermined format can be pre-set and is certain, avoiding the generation of random ports. The use of messages in a predetermined format is conducive to the problem of secure data transmission.

[0065] Among them, the request message is used to request to obtain the file stored in the temporary folder of the transit server. When the request message is obtained and converted into a message in a predetermined format, the file to be transferred requested in the message in the predetermined format and the server information sending the request message are determined, so that the file to be transferred specified in the request message can be sent to the server related to the server information for storage based on the obtained server information.

[0066] Among them, the server that sends the request message can be the caller server or the consumer server. If the file to be transferred specified in the request message is sent by the caller server to the transit server and stored, the server that sends the request message is the consumer server; if the file to be transferred specified in the request message is sent by the consumer server to the transit server and stored, the server that sends the request message is the caller server.

[0067] The file transmission method disclosed in this embodiment obtains the file to be transmitted, stores the file to be transmitted in a temporary folder of the transit server; obtains a request message, converts the request message into a predetermined format message adapted to the transit server, determines the consumer server information or the caller server information for receiving the file to be transmitted specified by the predetermined format message based on the predetermined format message, and transmits the file to be transmitted stored in the temporary folder of the transit server to the designated folder of the consumer server or the caller server based on the consumer server information or the caller server information for storage. When transmitting the file to be transmitted in this scheme, the file to be transmitted is stored by the transit server, and the file to be transmitted stored in the transit server is output to other servers, and the request message is converted into a predetermined format message, and the message protocol is unified by the transit server to avoid the FTP or SFTP protocol from circulating in the server cluster, and the network isolation between the file provider network, the transit network and the file acquirer network is realized by the transit server, thereby ensuring the security during the file transmission process.

[0068] This embodiment discloses a file transmission method, and its flow chart is as follows: Figure 2 As shown, including:

[0069] Step S21, obtaining a first file to be transmitted via a first transmission mode;

[0070] Step S22: determining whether the transit server includes a first file storage path of the first file to be transmitted;

[0071] Step S23: if the transit server includes a first file storage path of the first file to be transmitted, the first file to be transmitted is stored in a first temporary folder specified by the first file storage path in the transit server;

[0072] Step S24: obtaining a request message, and converting the request message into a message in a predetermined format adapted to the transit server;

[0073] Step S25, determining, based on the message in the predetermined format, the information of the consumer server or the caller server for receiving the file to be transmitted specified by the message in the predetermined format;

[0074] Step S26: Based on the consumer server information or the caller server information, the to-be-transmitted file stored in the temporary folder of the transit server is transferred to the designated folder of the consumer server or the caller server for storage.

[0075] The first transmission mode may be an Fserver mode. The file transmitted to the transfer server through the Fserver mode may be a file in any format, such as word, excel, txt, image, etc. In a specific business scenario, it is a file with practical significance, which contains relevant information.

[0076] When the file to be transmitted is transmitted to the transit server through the Fserver mode, the file to be transmitted is sent from the calling server and stored in a temporary folder of the transit server so as to be sent to the consumer server.

[0077] It is determined whether the transit server includes a file storage path of a first file to be transmitted via a first transmission mode, ie, a first file storage path, where the first file storage path is a path for storing the first file to be transmitted in the transit server.

[0078] If it is determined that the first file storage path exists in the transit server, the first file to be transmitted sent by the caller server is stored in the first temporary folder specified by the first file storage path in the transit server. That is, the first file storage path is used to indicate in which specific folder the first file to be transmitted is stored, and based on the first file storage path, the first file to be transmitted is stored in the first temporary folder, and the first temporary folder is used to temporarily store the file to be transmitted sent by the caller server;

[0079] If it is determined that the first file storage path does not exist in the transit server, that is, there is no temporary folder for storing the first file to be transferred, it is necessary to create a temporary folder in the transit server, that is, a second temporary folder, so as to store the file to be transferred sent by the calling server to the transit server through the second temporary folder.

[0080] After the second temporary folder is created, a file storage path is generated based on the second temporary folder, so that the first file to be stored and transmitted obtained by the transit server is stored in the second temporary folder based on the file storage path.

[0081] The temporary folder may be related to the server that sent the file to be transmitted, or may be related to the current time, that is, the temporary folder is used to store the files to be transmitted sent by all servers obtained on the current date, and is not limited to a certain type or a certain server. Specifically, if the temporary folder is related to the current time, the temporary folder may be named with the current date, and correspondingly, the files to be transmitted stored in the temporary folder are named with the current timestamp, so that the files to be transmitted can be directly located based on the timestamp.

[0082] Furthermore, the file to be transmitted can also be obtained through the second transmission method, specifically:

[0083] Obtain a second file to be transmitted via a second transmission method, encrypt the file stream of the second file to be transmitted to obtain an encrypted file stream, obtain the number of bytes of the file stream of the second file to be transmitted, and store the number of bytes in combination with the encrypted file stream in a third temporary folder of the transit server.

[0084] The second transmission mode may be Socket mode. The file transmitted to the transfer server via Socket mode may also be a file in any format, such as word, excel, txt, image, etc. In a specific business scenario, it is a file with practical significance, which contains relevant information.

[0085] When the transit server obtains the second file to be transmitted through the second transmission mode, the file stream of the second file to be transmitted can be determined, wherein the file stream is in the Socket protocol, and the file is transmitted in the form of a binary stream, that is, the file is read out in byte order and then transmitted in byte order. After obtaining the file stream, the file stream is encrypted to obtain the encrypted file stream. The file stream can be encrypted by using the SM4 encryption method, and the encrypted file stream is stored in a cache so that the encrypted file stream can be used directly in the future.

[0086] The number of bytes of the file stream of the second file to be transmitted is obtained, and the number of bytes is combined with the encrypted file stream to obtain combined information. Only the combined information will be completely transmitted and stored in the transit server.

[0087] The number of bytes is combined with the encrypted file stream, which can be specifically: the number of bytes is placed in the first 10 bits of the encrypted file stream message, or the number of bytes is placed in the first n bits of the encrypted file stream message, where n is a positive integer. If the number of bytes is less than n, it is padded with 0.

[0088] The combined information is stored in a third temporary folder of the relay server.

[0089] Furthermore, after the file to be transmitted is stored in the temporary folder of the transit server, the transit server will receive a request message sent by the consumer server that needs to obtain the file to be transmitted.

[0090] The request message can be obtained specifically as follows: assemble the message according to the request format of the caller server, obtain the key from the configuration file, and encrypt the message through the SM4 encryption method; obtain the connection parameters of the consumer server from the configuration file, and connect to the transit server through the second transmission method, so that the transit server first reads the first 8 bits of the message, and the transit server determines the number of bytes read by the subsequent message through the first 8 bits of the message first read, wherein the number of bytes read by the subsequent message is the content of the file.

[0091] The configuration file is a configuration file provided by the consumer server, and the connection parameters of the consumer server include at least: IP address, port, etc.

[0092] The transit server obtains a request message. If the request message is sent by the consumer server, the request message is a request to obtain the file to be transmitted stored in the temporary folder of the transit server.

[0093] Specifically, the transit server first receives the first 8 bits of the request message, determines the length of the message body file stream, determines whether the file stream is received in full based on the message body file stream length, and then receives the entire request message body when it is determined that all of the file stream needs to be received.

[0094] Specifically, the transit server obtains the key from the configuration file in the request message, decrypts it through the above encryption method, that is, through SM4 decryption, to obtain the information of the consumer server stored in the configuration file.

[0095] The method of uploading files from the transit server to the consumer server can be determined by the number of parameters. In the message, the number of parameters in the message is determined by the separator "|", such as: "A|B|C" indicates that there are 3 parameters. The method of uploading files from the transit server to the consumer server can be determined by the number of parameters, such as: 3 parameters indicate that the file needs to be transferred to the consumer server through the first transmission method, and 4 parameters indicate that the file needs to be transferred to the consumer server through the second transmission method.

[0096] If it is determined that the first transmission method is used to transmit the file to be transmitted to the consumer server, the file name of the file to be transmitted is directly obtained and the file upload operation is performed; if it is determined that the second transmission method is used to transmit the file to be transmitted to the consumer server, the first 10 bits of the message are received first, and after obtaining the length of the message body file stream, it is determined whether the file stream is fully received, and then all file streams are received. The storage path of the temporary folder storing the file to be transmitted is obtained from the configuration file, and then the key is obtained, and the file to be transmitted is transferred from the temporary folder to the consumer server through SM4 decryption.

[0097] When transferring the file to be transferred from the temporary folder to the consumer server, it is necessary to first determine whether there is a second file storage path in the consumer server for storing the third file to be transferred specified by the predetermined format message; if it is determined that the second file storage path is not included in the consumer server, create a fourth temporary folder that conforms to the second file storage path, and send the third file to be transferred stored in the transit server to the consumer server, so as to store the third file to be transferred in the fourth temporary folder.

[0098] That is, when transferring the file to be transferred from the temporary folder to the consumer server, it is necessary to first determine whether the consumer server has a folder for storing the file to be transferred. If so, directly determine the storage path of the folder for storing the file to be transferred in the consumer server, and store the file to be transferred in the folder corresponding to the storage path based on the storage path; if there is no folder for storing the file to be transferred in the consumer server, it is necessary to first create a temporary folder and determine the storage path of the temporary folder, and then store the file to be transferred in the temporary folder, thereby completing the storage of the file to be transferred from the caller server to the transit server, and storing it in the consumer server after being transferred by the transit server.

[0099] Further, after storing the file to be transmitted in the consumer server, the transit server will obtain a return result sent by the consumer server, and the return result is used to indicate that the third file to be transmitted is stored in the fourth temporary folder.

[0100] That is, after the file to be transferred is stored in the consumer server, the consumer server will send the result to the transit server, so that the transit server can know that the file to be transferred has been stored in the corresponding location of the consumer server. When the transit server obtains the result, it will send the result to the calling server, even if the initiator knows that the file to be transferred has been stored in the consumer server.

[0101] Among them, the return result sent by the consumer server to the transit server may include two parts: status and prompt content. The two parts may be separated by a separator "|", and the message of the return result may be encrypted.

[0102] Specifically, the first 8 bits of the message returned are the byte length of the encrypted message, and the message after the first 8 bits is the encrypted message content.

[0103] Specifically, the working scenario can be as follows Figure 3 As shown, it includes: a transit server 31, multiple file providers, namely multiple caller servers 32, and multiple consumer servers 33. The caller servers can send the files to be transmitted to the transit server in different ways, and the transit server can also send the files to be transmitted to the consumer server in different ways. The transit server predefines a message format, and the port generated can be pre-set and is random, thereby avoiding the generation of random ports.

[0104] The file transmission method disclosed in this embodiment obtains the file to be transmitted, stores the file to be transmitted in a temporary folder of the transit server; obtains a request message, converts the request message into a predetermined format message adapted to the transit server, determines the consumer server information or the caller server information for receiving the file to be transmitted specified by the predetermined format message based on the predetermined format message, and transmits the file to be transmitted stored in the temporary folder of the transit server to the designated folder of the consumer server or the caller server based on the consumer server information or the caller server information for storage. When transmitting the file to be transmitted in this scheme, the file to be transmitted is stored by the transit server, and the file to be transmitted stored in the transit server is output to other servers, and the request message is converted into a predetermined format message, and the message protocol is unified by the transit server to avoid the FTP or SFTP protocol from circulating in the server cluster, and the network isolation between the file provider network, the transit network and the file acquirer network is realized by the transit server, thereby ensuring the security during the file transmission process.

[0105] This embodiment discloses a file transmission method, and its flow chart is as follows: Figure 4 As shown, including:

[0106] Step S41, obtaining a file download request;

[0107] Step S42: determining, based on the file download request, that the file to be downloaded is stored in the first consumer server;

[0108] Step S43: determine that the connection mode between the transit server and the first consumer server is a first connection mode, and obtain and store the file to be downloaded from the first consumer server based on the first connection mode;

[0109] Step S44: obtaining a request message, and converting the request message into a message in a predetermined format adapted to the transit server;

[0110] Step S45, determining, based on the message in the predetermined format, information of a calling server for receiving the file to be downloaded specified by the message in the predetermined format;

[0111] Step S46: Based on the caller server information, the to-be-downloaded file stored in the temporary folder of the transit server is transferred to the designated folder of the caller server for storage.

[0112] When the transit server obtains a file download request, the download request is usually sent by the calling server, and the calling server requests to download a file to be downloaded that is stored in a consumer server.

[0113] That is, when the relay server obtains a file download request, the relay server needs to determine the file to be downloaded specified by the file download request, and determine that the file to be downloaded is currently stored in the first consumer server. After determining that the file to be downloaded is stored in the first consumer server, a connection needs to be established between the relay server and the first consumer server so that the first consumer server can send the file to be downloaded stored in its internal storage to the relay server for storage.

[0114] To achieve connection with the first consumer server, it is necessary to first determine through the configuration file whether to use JAVA or SHELL mode to connect to the consumer server, and then determine the connection method of the first consumer server by parsing the message, that is, parse the message of the file download request to determine whether the connection method for connecting to the first consumer server is the first connection method or the second connection method, and then enter the file storage path of the first consumer server by passing the message content parameters, obtain the file to be downloaded stored in the storage folder corresponding to the file storage path of the first consumer server, and store it in the temporary folder of the transit server.

[0115] Among them, the temporary folder of the transit server also needs to be obtained from the configuration file. If the temporary folder exists in the transit server, the file to be downloaded is directly stored in the temporary folder; if the temporary folder does not exist in the transit server, a corresponding temporary folder is created and named with the current date, and then the file to be downloaded is stored in the temporary folder.

[0116] The file to be downloaded stored in the temporary folder is renamed. The file to be downloaded can be named based on the timestamp when the file to be downloaded is stored in the temporary folder to facilitate searching.

[0117] The specific type of the file to be downloaded may vary based on different specific scenarios, or may be determined based on actual needs. For example, the file to be downloaded may be a transaction details.txt file.

[0118] After the file to be downloaded is stored in the transit server, a return message may be generated and sent to the first consumer server so that the first consumer server can determine that the file to be downloaded has been stored in the transit server.

[0119] Specifically, the notification information to be sent to the first consumer server is encrypted as a message, and then the encrypted message byte length is added before the encrypted notification information message to form a return message, wherein the encrypted message byte length is set in the first 8 bits of the return message, that is, the first 8 bits of the return message are the encrypted message byte length, followed by the encrypted notification information message.

[0120] The method of downloading the file can be determined by the number of request parameters, and the details can be referred to the description of the previous embodiment.

[0121] If it is determined that the method for downloading files is the second connection method, the file stream downloaded from the first consumer server is obtained, encrypted using the SM4 method, and stored in the cache of the transit server. The number of file stream bytes is obtained and placed in the first 10 bits of the file stream message. If the number of file stream bytes is less than 10 bits, it is padded with 0. That is, the first 10 bits of the message of the file to be downloaded stored in the transit server are the number of file stream bytes, followed by the file stream content.

[0122] Furthermore, after the file to be downloaded is stored in the transit server, it is necessary to obtain the message information of the caller server information, determine the transmission method for transmitting the file to be downloaded based on the message information of the caller server, and send the file to be downloaded to the caller server through the determined transmission method, so that the caller server can store the file to be downloaded based on the transmission method.

[0123] After obtaining the request sent by the calling server to download the file to be downloaded, the transit server assembles the message. Specifically, it uses the "|" separator to separate, and stores the IP address, login name, login password, file transfer method, storage path, transit server file path, transit service file name and other related parameters of the first consumer server, obtains the key from the configuration file, and encrypts the message using the SM4 encryption method.

[0124] Get the transit service connection parameters from the configuration file, such as IP address, port, etc., connect to the transit service through the second connection method, and the first 8 bits of the incoming message are the message content byte length and the encrypted message byte stream.

[0125] After the message is assembled, it is sent to the calling server so that the transit server can establish a connection with the calling server and confirm that the connection is successful so that the file can be transferred.

[0126] If the calling server obtains the assembly message, it indicates that the calling server is successfully connected to the transit server. At this time, the calling server needs to obtain the file to be downloaded stored in the transit server.

[0127] Specifically, if the calling server is connected to the transit server via the first connection method, then after the transit server is successfully connected to the calling server, that is, after the calling server obtains the above-mentioned assembled message, the calling server needs to parse the above-mentioned assembled message, obtain the temporary storage path and file name of the file to be downloaded in the transit server, and through the configuration file parameters, call the first connection method to obtain the file with the file name from the temporary folder corresponding to the temporary storage path of the transit server, and store it locally on the calling server, thereby completing the file download process.

[0128] If the calling server is connected to the transit server via the second connection method, then after the transit server is successfully connected to the calling server, the calling server first obtains the 10-bit file stream length, then receives all file stream data, reads the configuration file key, and decrypts it using the SM4 method, thereby completing the operation process of downloading the file to the local calling server.

[0129] The file transmission method disclosed in this embodiment obtains a file download request, determines that the file to be downloaded is stored in the first consumer server based on the file download request, determines that the connection mode between the transit server and the first consumer server is the first connection mode, obtains and stores the file to be downloaded from the first consumer server based on the first connection mode; obtains a request message, converts the request message into a predetermined format message adapted to the transit server, determines the caller server information for receiving the file to be downloaded specified by the predetermined format message based on the predetermined format message, and transmits the file to be transmitted stored in the temporary folder of the transit server to the designated folder of the caller server for storage based on the caller server information. In this scheme, when transmitting the file to be downloaded, the transit server is used to store the file to be downloaded, and the file to be downloaded stored in the transit server is output to other servers, and the request message is converted into a predetermined format message, and the message protocol is unified through the transit server to avoid the FTP or SFTP protocol from circulating in the server cluster, and the network isolation between the file provider network, the transit network and the file acquirer network is realized through the transit server, thereby ensuring the security of the file transmission process.

[0130] This embodiment discloses a file transmission device, and its structural diagram is shown in FIG. Figure 5 As shown, including:

[0131] A first obtaining unit 51 , a second obtaining unit 52 , a determining unit 53 and a storage unit 54 .

[0132] The first obtaining unit 51 is used to obtain the file to be transmitted, and store the file to be transmitted in a temporary folder of the transfer server;

[0133] The second obtaining unit 52 is used to obtain the request message and convert the request message into a message in a predetermined format adapted to the transit server;

[0134] The determination unit 53 is used to determine, based on the message in the predetermined format, the information of the consumer server or the caller server for receiving the file to be transmitted specified by the message in the predetermined format;

[0135] The storage unit 54 is used to transfer the to-be-transmitted files stored in the temporary folder of the transit server to the designated folder of the consumer server or the caller server for storage based on the consumer server information or the caller server information.

[0136] Furthermore, the first obtaining unit is used for:

[0137] Obtain a first file to be transmitted via a first transmission method; determine whether the transit server includes a first file storage path for the first file to be transmitted; if the transit server includes the first file storage path for the first file to be transmitted, store the first file to be transmitted in a first temporary folder specified by the first file storage path in the transit server; if the transit server does not include the first file storage path for the first file to be transmitted, create a second temporary folder that conforms to the first file storage path for the first file to be transmitted, and store the first file to be transmitted in the second temporary folder.

[0138] Furthermore, the first obtaining unit is used for:

[0139] Obtain a second file to be transmitted via a second transmission method; encrypt the file stream of the second file to be transmitted to obtain an encrypted file stream; obtain the number of bytes of the file stream of the second file to be transmitted, and store the number of bytes and the encrypted file stream in a third temporary folder of the transit server.

[0140] Furthermore, the storage unit is used for:

[0141] Determining whether the consumer server includes a second file storage path for storing a third file to be transmitted specified by the message in a predetermined format;

[0142] If it is determined that the consumer server does not include the second file storage path, create a fourth temporary folder that conforms to the second file storage path, and send the third file to be transmitted stored in the transit server to the consumer server so that the third file to be transmitted can be stored in the fourth temporary folder.

[0143] Furthermore, the storage unit is also used to: obtain a return result sent by the consumer server, where the return result is used to indicate that the third file to be transmitted is stored in the fourth temporary folder.

[0144] Furthermore, the first obtaining unit is used for:

[0145] Obtain a file download request; determine that the file to be downloaded is stored in the first consumer server based on the file download request; determine that the connection method between the transit server and the first consumer server is a first connection method, and obtain and store the file to be downloaded from the first consumer server based on the first connection method.

[0146] Furthermore, the storage unit is used for:

[0147] Get the message information of the calling server;

[0148] Determine the transmission mode of the file to be downloaded by transmitting the file to be downloaded based on the message information of the caller server information;

[0149] The file to be downloaded is sent to the calling server through the determined transmission mode, so that the calling server can store the file to be downloaded based on the transmission mode.

[0150] The file transmission device disclosed in this embodiment is implemented based on the file transmission method disclosed in the above embodiment, which will not be described in detail here.

[0151] The file transmission device disclosed in this embodiment obtains the file to be transmitted, stores the file to be transmitted in a temporary folder of the transit server; obtains a request message, converts the request message into a predetermined format message adapted to the transit server, determines the consumer server information or the caller server information for receiving the file to be transmitted specified by the predetermined format message based on the predetermined format message, and transmits the file to be transmitted stored in the temporary folder of the transit server to the designated folder of the consumer server or the caller server based on the consumer server information or the caller server information for storage. When transmitting the file to be transmitted in this scheme, the file to be transmitted is stored by the transit server, and the file to be transmitted stored in the transit server is output to other servers, and the request message is converted into a predetermined format message, and the message protocol is unified by the transit server to avoid the FTP or SFTP protocol from circulating in the server cluster, and the network isolation between the file provider network, the transit network and the file acquirer network is realized by the transit server, thereby ensuring the security during the file transmission process.

[0152] This embodiment discloses an electronic device, and its structural diagram is as follows: Figure 6 As shown, including:

[0153] Processor 61 and memory 62.

[0154] The processor 61 is used to obtain the file to be transmitted, and store the file to be transmitted in a temporary folder of the transit server; obtain a request message, and convert the request message into a predetermined format message adapted to the transit server; determine the consumer server information or the caller server information for receiving the file to be transmitted specified by the predetermined format message based on the predetermined format message; based on the consumer server information or the caller server information, transfer the file to be transmitted stored in the temporary folder of the transit server to the designated folder of the consumer server or the caller server for storage;

[0155] The memory 62 is used to store the program for the processor to execute the above-mentioned processing process.

[0156] The electronic device disclosed in this embodiment is implemented based on the file transmission method disclosed in the above embodiments, which will not be described in detail here.

[0157] The electronic device disclosed in this embodiment obtains the file to be transmitted, stores the file to be transmitted in a temporary folder of the transit server; obtains a request message, converts the request message into a predetermined format message adapted to the transit server, determines the consumer server information or the caller server information for receiving the file to be transmitted specified by the predetermined format message based on the predetermined format message, and transmits the file to be transmitted stored in the temporary folder of the transit server to the designated folder of the consumer server or the caller server based on the consumer server information or the caller server information for storage. When transmitting the file to be transmitted in this scheme, the file to be transmitted is stored by the transit server, and the file to be transmitted stored in the transit server is output to other servers, and the request message is converted into a predetermined format message, and the message protocol is unified by the transit server to avoid the FTP or SFTP protocol from circulating in the server cluster, and the network isolation between the file provider network, the transit network and the file acquirer network is realized by the transit server, thereby ensuring the security during the file transmission process.

[0158] This embodiment discloses a file transmission system, and its structural diagram is as follows: Figure 7 As shown, including:

[0159] The calling server 71, the transit server 72 and the consuming server 73.

[0160] The calling server 71 is used to send the file to be transmitted to the transit server, and / or obtain and store the file to be transmitted from the transit server;

[0161] The transit server 72 is used to obtain the file to be transmitted sent by the calling server or the consumer server, and store the file to be transmitted in a temporary folder; obtain the request message sent by the consumer server or the calling server, convert the request message into a predetermined format message adapted to the transit server, determine the consumer server information or the calling server information for receiving the file to be transmitted specified by the predetermined format message based on the predetermined format message, and transmit the file to be transmitted stored in the temporary folder to the designated folder of the consumer server or the calling server based on the consumer server information or the calling server information for storage;

[0162] The consumer server 73 is used to obtain and store the files to be transmitted sent by the transit server, and / or send the files to be transmitted stored in the designated folder of the consumer server to the transit server.

[0163] The file transmission system disclosed in this embodiment is implemented based on the file transmission method disclosed in the above embodiment, which will not be described in detail here.

[0164] The file transfer system disclosed in this embodiment obtains the file to be transferred, stores the file to be transferred in a temporary folder of the transit server; obtains a request message, converts the request message into a predetermined format message adapted to the transit server, determines the consumer server information or the caller server information for receiving the file to be transferred specified by the predetermined format message based on the predetermined format message, and transfers the file to be transferred stored in the temporary folder of the transit server to the designated folder of the consumer server or the caller server based on the consumer server information or the caller server information for storage. When transmitting the file to be transferred in this scheme, the file to be transferred is stored by the transit server, and the file to be transferred stored in the transit server is output to other servers, and the request message is converted into a predetermined format message, and the message protocol is unified by the transit server to avoid the FTP or SFTP protocol from circulating in the server cluster, and the network isolation between the file provider network, the transit network and the file acquirer network is realized by the transit server, thereby ensuring the security during the file transfer process.

[0165] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0166] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0167] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0168] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A file transmission method, characterized in that: include: Obtaining a file to be transmitted, and storing the file to be transmitted in a temporary folder of the transfer server; Obtaining a request message, and converting the request message into a message in a predetermined format adapted to the transit server; wherein the obtained request message is a message of the FTP or SFTP protocol; and the port generated by the protocol corresponding to the predetermined format message is determined; Determine, based on the message in the predetermined format, information of a consumer server or information of a caller server for receiving the file to be transmitted specified by the message in the predetermined format; Based on the consumer server information or the caller server information, the to-be-transmitted file stored in the temporary folder of the transit server is transmitted to a designated folder of the consumer server or the caller server for storage.

2. The method according to claim 1, characterized in that The obtaining of the file to be transmitted and storing the file to be transmitted in a temporary folder of the transfer server includes: Obtaining a first file to be transmitted through a first transmission mode; Determining whether the transfer server includes a first file storage path of a first file to be transferred; If the transfer server includes a first file storage path of the first file to be transferred, storing the first file to be transferred in a first temporary folder specified by the first file storage path in the transfer server; If the transfer server does not include the first file storage path of the first file to be transmitted, create a second temporary folder that matches the first file storage path of the first file to be transmitted, and store the first file to be transmitted in the second temporary folder.

3. The method according to claim 1, characterized in that: The obtaining of the file to be transmitted and storing the file to be transmitted in a temporary folder of the transfer server includes: Obtaining a second file to be transmitted through a second transmission mode; Encrypting the file stream of the second file to be transmitted to obtain an encrypted file stream; The number of bytes of the file stream of the second file to be transmitted is obtained, and the number of bytes is combined with the encrypted file stream and stored in a third temporary folder of the transit server.

4. The method according to any one of claims 1 to 3, characterized in that: The method of transferring the to-be-transmitted file stored in the temporary folder of the transit server to a designated folder of the consumer server or the caller server for storage based on the consumer server information or the caller server information includes: Determining whether the consumer server includes a second file storage path for storing a third file to be transmitted specified by the predetermined format message; If it is determined that the second file storage path is not included in the consumer server, a fourth temporary folder that conforms to the second file storage path is created, and the third file to be transmitted stored in the transit server is sent to the consumer server so that the third file to be transmitted can be stored in the fourth temporary folder.

5. The method according to claim 4, characterized in that Also includes: A return result sent by the consumer server is obtained, where the return result is used to indicate that the third file to be transmitted is stored in the fourth temporary folder.

6. The method according to claim 1, characterized in that The obtaining of the file to be transmitted and storing the file to be transmitted in a temporary folder of the transfer server includes: Get a file download request; Determining, based on the file download request, that the file to be downloaded is stored in the first consumer server; Determine that the connection mode between the transit server and the first consumer server is a first connection mode, and obtain and store the file to be downloaded from the first consumer server based on the first connection mode.

7. The method according to claim 6, characterized in that The transferring of the to-be-transmitted file stored in the temporary folder of the transit server to a designated folder of the consumer server or the caller server for storage based on the consumer server information or the caller server includes: Obtaining the message information of the calling server information; Determine a transmission mode of transmitting the file to be downloaded based on the message information of the calling server information; The file to be downloaded is sent to the calling server through the determined transmission mode, so that the calling server stores the file to be downloaded based on the transmission mode.

8. A file transmission device, characterized in that: include: A first obtaining unit, used to obtain a file to be transmitted, and store the file to be transmitted in a temporary folder of the transit server; A second obtaining unit is used to obtain a request message and convert the request message into a message in a predetermined format adapted to the transit server; wherein the obtained request message is a message of the FTP or SFTP protocol; and the port generated by the protocol corresponding to the predetermined format message is determined; A determining unit, configured to determine, based on the message in the predetermined format, information about a consumer server or a caller server for receiving the file to be transmitted specified by the message in the predetermined format; The storage unit is used to transfer the to-be-transmitted files stored in the temporary folder of the transit server to the designated folder of the consumer server or the caller server for storage based on the consumer server information or the caller server information.

9. An electronic device, characterized in that: include: The processor is used to obtain the file to be transmitted and store the file to be transmitted in a temporary folder of the transfer server; Obtain a request message, and convert the request message into a message of a predetermined format adapted to the transit server; wherein the obtained request message is a message of the FTP or SFTP protocol; the port generated by the protocol corresponding to the message of the predetermined format is determined; based on the message of the predetermined format, determine the consumer server information or the caller server information for receiving the file to be transferred specified by the message of the predetermined format; based on the consumer server information or the caller server information, transfer the file to be transferred stored in the temporary folder of the transit server to the designated folder of the consumer server or the caller server for storage; The memory is used to store the program for the processor to execute the above processing process.

10. A file transmission system, characterized in that: include: The calling server is used to send the file to be transmitted to the transit server, and / or obtain and store the file to be transmitted from the transit server; The transfer server is used to obtain the file to be transmitted sent by the calling server or the consuming server, and store the file to be transmitted in a temporary folder; Obtain a request message sent by a consumer server or a caller server, and convert the request message into a predetermined format message adapted to the transit server, wherein the obtained request message is a message of the FTP or SFTP protocol; the port generated by the protocol corresponding to the predetermined format message is determined; based on the predetermined format message, determine the consumer server information or the caller server information for receiving the file to be transferred specified by the predetermined format message, and based on the consumer server information or the caller server information, transfer the file to be transferred stored in the temporary folder to the designated folder of the consumer server or the caller server for storage; The consumer server is used to obtain and store the files to be transmitted sent by the transit server, and / or send the files to be transmitted stored in the designated folder of the consumer server to the transit server.

Citation Information

Patent Citations

  • Data exchange method capable of simultaneously supporting multiple communication protocols and multiple packet specifications

    CN102868623A

  • Cloud storage system

    CN108415962A

  • Data transmission method, device and system

    CN110022289A

  • File transmission method and system and storage medium

    CN110099104A

  • File uploading method and device, electronic equipment and computer readable medium

    CN110493350A