CN114448974A - Remote file transmission method, device, equipment and storage medium - Google Patents
Remote file transmission method, device, equipment and storage medium Download PDFInfo
- Publication number
- CN114448974A CN114448974A CN202210035914.6A CN202210035914A CN114448974A CN 114448974 A CN114448974 A CN 114448974A CN 202210035914 A CN202210035914 A CN 202210035914A CN 114448974 A CN114448974 A CN 114448974A
- Authority
- CN
- China
- Prior art keywords
- file
- target
- remote
- preset
- stream
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 230000005540 biological transmission Effects 0.000 title claims abstract description 95
- 238000000034 method Methods 0.000 title claims abstract description 60
- 238000006243 chemical reaction Methods 0.000 claims description 22
- 238000012546 transfer Methods 0.000 claims description 21
- 230000002159 abnormal effect Effects 0.000 claims description 13
- 238000012545 processing Methods 0.000 claims description 8
- 230000006399 behavior Effects 0.000 claims description 7
- 230000008569 process Effects 0.000 description 8
- 238000004891 communication Methods 0.000 description 5
- 238000010586 diagram Methods 0.000 description 4
- 230000006870 function Effects 0.000 description 4
- 238000010606 normalization Methods 0.000 description 2
- 230000009471 action Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- PCHJSUWPFVWCPO-UHFFFAOYSA-N gold Chemical compound [Au] PCHJSUWPFVWCPO-UHFFFAOYSA-N 0.000 description 1
- 239000010931 gold Substances 0.000 description 1
- 229910052737 gold Inorganic materials 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000013507 mapping Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000012856 packing Methods 0.000 description 1
- 238000005192 partition Methods 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/06—Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/08—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
- H04L43/0805—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
- H04L43/0811—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking connectivity
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/02—Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
Abstract
The invention belongs to the technical field of computers, and discloses a remote file transmission method, a device, equipment and a storage medium. The method comprises the following steps: creating a socket connection with a target file storage server; reading a binary stream of a file to be sent through socket connection, and storing the binary stream into a preset memory; acquiring a file byte stream from a preset memory, and converting the file byte stream into data to be transmitted according to a preset file storage protocol; and sending the data to be transmitted to a target file storage server. By the method, the socket is used for carrying out remote file transmission by using the preset file storage protocol, only one port is fixedly occupied on the server where the program is located, and the theoretical value of the quantity of the concurrent requests which can be processed is hardly influenced.
Description
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a storage medium for remote file transmission.
Background
Currently, there are two storage modes for attachments, the first mode is storage on a local hard disk of a server where an application is located, and the second mode is placement on a remote server by using an HTTP protocol. In the first mode, disk expansion needs to be performed regularly to prevent the disk from being incapable of being written continuously after being full, and the server needs to be shut down first in the scheme, which can cause the problem of server shutdown. In the second mode, when a file is transmitted by using the HTTP protocol, a random port is newly opened on the server, and a program occupies 2 ports when processing a request, so that the theoretical value of concurrent requests that can be processed is reduced by one time.
The above is only for the purpose of assisting understanding of the technical aspects of the present invention, and does not represent an admission that the above is prior art.
Disclosure of Invention
The invention mainly aims to provide a remote file transmission method, a device, equipment and a storage medium, aiming at solving the technical problem that the number of concurrent requests processed by a server where a program is located is reduced when a file is transmitted by using an HTTP protocol in the prior art.
In order to achieve the above object, the present invention provides a remote file transmission method, including the following steps:
creating a socket connection with a target file storage server;
reading a binary stream of a file to be sent, and storing the binary stream into a preset memory;
acquiring a file byte stream from the preset memory, and converting the file byte stream into data to be transmitted according to a preset file storage protocol;
and sending the data to be transmitted to the target file storage server through the socket connection.
Optionally, the obtaining the file byte stream from the preset memory, and converting the file byte stream into data to be transmitted according to a preset file storage protocol includes:
acquiring a file byte stream from the preset memory, and determining the data length corresponding to the file byte stream;
converting the data length into a length character string according to a preset conversion strategy;
and splicing the preset behavior code, the length character string and the file byte stream according to a preset file storage protocol to obtain data to be transmitted.
Optionally, the converting the data length into a length string according to a preset conversion policy includes:
carrying out binary conversion on the data length to obtain a current character string;
and carrying out standardization processing on the current character string according to a preset byte number to obtain a length character string, wherein the byte number of the length character string is consistent with the preset byte number.
Optionally, after creating a socket connection with the target file storage server, the method further includes:
acquiring returned abnormal information;
and sending out prompt information of abnormal connection when the abnormal information is detected not to be empty.
Optionally, before the reading of the binary stream of the file to be sent and the storing of the binary stream into the preset memory, the method further includes:
acquiring a preset file path;
judging whether a file to be sent exists in the preset file path or not;
if yes, executing a step of reading a binary stream of the file to be sent and storing the binary stream into a preset memory;
if not, sending out error prompt information.
Optionally, the method further comprises:
acquiring a remote transmission task list comprising a plurality of remote transmission tasks;
sequentially determining target remote transmission tasks according to the sequence of the remote transmission task list;
establishing a target socket connection with a file storage server corresponding to the target remote transmission task;
acquiring a target file to be sent corresponding to the target remote transmission task;
reading the binary stream of the target file to be sent, and storing the binary stream into a corresponding target preset memory;
acquiring a target file byte stream from the target preset memory, and converting the target file byte stream into target data to be transmitted according to a preset file storage protocol;
and sending the target data to be transmitted to a file storage server corresponding to the target remote transmission task through the target socket connection.
Optionally, before the file storage server corresponding to the target remote transmission task creates a target socket connection, the method further includes:
acquiring a current connection list, and determining information of connected equipment according to the current connection list;
determining opposite terminal equipment information corresponding to the target remote transmission task;
and when the connected device information does not contain the opposite-end device information, executing the step of establishing target socket connection by the file storage server corresponding to the target remote transmission task.
In addition, in order to achieve the above object, the present invention further provides a remote file transmission apparatus, including:
the connection module is used for establishing socket connection with the target file storage server;
the reading module is used for reading the binary stream of the file to be sent and storing the binary stream into a preset memory;
the conversion module is used for acquiring the file byte stream from the preset memory and converting the file byte stream into data to be transmitted according to a preset file storage protocol;
and the sending module is used for sending the data to be transmitted to the target file storage server through the socket connection.
In addition, to achieve the above object, the present invention further provides a remote file transmission device, including: a memory, a processor, and a remote file transfer program stored on the memory and executable on the processor, the remote file transfer program configured to implement a remote file transfer method as described above.
In addition, to achieve the above object, the present invention further provides a storage medium having a remote file transfer program stored thereon, the remote file transfer program implementing the remote file transfer method as described above when executed by a processor.
The invention establishes socket connection with a target file storage server; reading a binary stream of a file to be sent through socket connection, and storing the binary stream into a preset memory; acquiring a file byte stream from a preset memory, and converting the file byte stream into data to be transmitted according to a preset file storage protocol; and sending the data to be transmitted to a target file storage server. By the method, the socket is used for carrying out remote file transmission by using the preset file storage protocol, only one port is fixedly occupied on the server where the program is located, and the theoretical value of the quantity of the concurrent requests which can be processed is hardly influenced.
Drawings
FIG. 1 is a schematic structural diagram of a remote file transfer device in a hardware operating environment according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a remote file transfer method according to a first embodiment of the present invention;
FIG. 3 is a flowchart illustrating a remote file transfer method according to a second embodiment of the present invention;
fig. 4 is a block diagram of a remote file transfer device according to a first embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Referring to fig. 1, fig. 1 is a schematic structural diagram of a remote file transmission device in a hardware operating environment according to an embodiment of the present invention.
As shown in fig. 1, the remote file transfer apparatus may include: a processor 1001, such as a Central Processing Unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a Wireless interface (e.g., a Wireless-Fidelity (Wi-Fi) interface). The Memory 1005 may be a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as a disk Memory. The memory 1005 may alternatively be a storage device separate from the processor 1001.
Those skilled in the art will appreciate that the configuration shown in FIG. 1 does not constitute a limitation of a remote file transfer device, and may include more or fewer components than those shown, or some components in combination, or a different arrangement of components.
As shown in fig. 1, a memory 1005, which is a storage medium, may include therein an operating system, a network communication module, a user interface module, and a remote file transfer program.
In the remote file transfer apparatus shown in fig. 1, the network interface 1004 is mainly used for data communication with a network server; the user interface 1003 is mainly used for data interaction with a user; the processor 1001 and the memory 1005 of the remote file transmission device of the present invention may be disposed in a remote file transmission device, and the remote file transmission device calls a remote file transmission program stored in the memory 1005 through the processor 1001 and executes the remote file transmission method provided by the embodiment of the present invention.
An embodiment of the present invention provides a remote file transmission method, and referring to fig. 2, fig. 2 is a flowchart illustrating a first embodiment of a remote file transmission method according to the present invention.
In this embodiment, the remote file transmission method includes the following steps:
step S10: a socket connection is created with the target file storage server.
It can be understood that the execution subject of this embodiment is a remote file transmission device, and the remote file transmission device may be a computer, a server, or other devices with the same or similar functions where the program runs, and this embodiment takes the server where the program runs as an example for description.
It should be noted that, in this embodiment, Socket connection (Socket) is created by using gold, and in a specific implementation, Socket connection is performed by using a net.
Further, after the step S10, the method further includes: acquiring returned abnormal information; and sending out prompt information of abnormal connection when the abnormal information is detected not to be empty.
It should be understood that when the exception information is not empty, it indicates that a connection exception occurs, and specific code examples are as follows:
step S20: and reading the binary stream of the file to be sent and storing the binary stream into a preset memory.
It should be noted that all the binary streams sent by the Socket are binary streams, in this embodiment, the binary streams of the file are read into the memory in advance, and the memory is preset as a memory area for storing the binary streams, which is set in advance.
Further, before the step S20, the method further includes: acquiring a preset file path; judging whether a file to be sent exists in the preset file path or not; if yes, go to step S20; if not, sending out error prompt information.
It will be appreciated that the binary stream of read files is read using ioutin. Before using the function, whether the file exists needs to be judged, if not, error information is thrown out, and the subsequent steps are terminated. The function returns two return values of the read binary array and the abnormal information, and if the abnormal information does not exist, the normal reading is successful. Specific code examples are as follows:
step S30: and acquiring the file byte stream from the preset memory, and converting the file byte stream into data to be transmitted according to a preset file storage protocol.
It should be noted that the preset file storage protocol is a file transmission conversion rule set in advance, and the binary byte stream corresponding to the file is transmitted according to the preset file storage protocol of this embodiment, which not only increases the privacy of file transmission, but also provides file related information for the peer device, so that the peer server executes corresponding storage operation according to the received data.
Specifically, the step S30 includes: acquiring a file byte stream from the preset memory, and determining the data length corresponding to the file byte stream; converting the data length into a length character string according to a preset conversion strategy; and splicing the preset behavior code, the length character string and the file byte stream according to a preset file storage protocol to obtain data to be transmitted.
It can be understood that, in this embodiment, a set of custom protocols is used as a socket file storage protocol, and a byte stream is used for transmission, where the custom protocols include an instruction, a data length, data to be processed, and the like, and an agreed binary byte bit is used as a protocol partition, specifically, the first 1 byte represents a preset behavior code, and 0x02 represents an attachment storage instruction, and after receiving the instruction, the server side stores and processes the sent byte stream by an attachment storage. Is defined as action _ code [ ] byte {0x02 }; 1-11 bytes represent the size of the file stream, defined as hex bytes; and splicing the byte streams according to the agreement, and splicing the behavior codes, the data length and the file binary byte stream into one byte stream.
In the concrete implementation, because the behavior code is a byte, the data length is a byte array with the length of 10, and the read file binary byte stream is also a byte array, the bits agreed by the protocol are spliced to obtain a complete protocol byte stream. For example, array packing is performed using an apend function.
Further, the converting the data length into a length string according to a preset conversion policy includes: carrying out binary conversion on the data length to obtain a current character string; and carrying out standardization processing on the current character string according to a preset byte number to obtain a length character string, wherein the byte number of the length character string is consistent with the preset byte number.
It should be noted that, the data length is decimal, optionally, the data length is subjected to binary conversion to obtain the current character string, including: and converting the data length into hexadecimal characters to obtain the current character string. The normalization process is to convert the current character string into a character of a preset length, and specifically, the normalization process is performed by complementing 0 in advance. For example, if the total file length is 100 bytes, 100 is converted to hexadecimal, if the 10-bit byte is not reached after the conversion, 0 is supplemented before the conversion, and 0x0000000064 is obtained after the 100 conversion. After reading the file byte stream, acquiring the length of the byte stream, converting the length into hexadecimal by the method to obtain a ten-bit length, recording a character string of the length by the hexadecimal, and defining the array as hex _ bytes.
Step S40: and sending the data to be transmitted to the target file storage server through the socket connection.
It will be appreciated that the data to be transmitted comprises storage instructions, file byte length, a binary stream of files, etc. Data transmission is performed using the connection handle acquired in step S10. Such as conn.
The embodiment creates a socket connection with the target file storage server; reading a binary stream of a file to be sent through socket connection, and storing the binary stream into a preset memory; acquiring a file byte stream from a preset memory, and converting the file byte stream into data to be transmitted according to a preset file storage protocol; and sending the data to be transmitted to a target file storage server. By the method, the socket is used for carrying out remote file transmission by using the preset file storage protocol, only one port is fixedly occupied on the server where the program is located, and the theoretical value of the quantity of the concurrent requests which can be processed is hardly influenced.
Referring to fig. 3, fig. 3 is a flowchart illustrating a remote file transmission method according to a second embodiment of the present invention.
Based on the first embodiment, the remote file transmission method of this embodiment further includes:
step S01: a remote transmission task list including a plurality of remote transmission tasks is obtained.
It is to be understood that each remote transmission task includes connection object information and a file storage location, and the remote transmission task list may be a mapping table constructed according to task numbers, connection object information and file storage locations of a plurality of remote transmission tasks.
Step S02: and sequentially determining target remote transmission tasks according to the sequence of the remote transmission task list.
Step S03: and establishing a target socket connection by the file storage server corresponding to the target remote transmission task.
Note that Socket connection is performed through a net.dial ("tcp", "server address") according to connection object information of the target remote transfer task.
Step S04: and acquiring a target file to be sent corresponding to the target remote transmission task.
It can be understood that, before step S04, obtaining a corresponding target file to be sent according to a file storage location of the target remote transmission task, further includes: acquiring a file storage position corresponding to a target remote transmission task; judging whether a target file to be sent exists in the file storage position; if yes, go to step S04; if not, sending out error prompt information.
Step S05: and reading the binary stream of the target file to be sent, and storing the binary stream into a corresponding target preset memory.
Step S06: and acquiring a target file byte stream from the target preset memory, and converting the target file byte stream into target data to be transmitted according to a preset file storage protocol.
Step S07: and sending the target data to be transmitted to a file storage server corresponding to the target remote transmission task through the target socket connection.
It should be noted that, the plurality of remote transmission tasks on the remote transmission task list are sequentially executed, so that a process of batch processing of the remote transmission tasks is realized, and the remote transmission efficiency is further improved.
Further, before the step S03, the method further includes: acquiring a current connection list, and determining information of connected equipment according to the current connection list; determining opposite terminal equipment information corresponding to the target remote transmission task; if the connected device information does not include the peer device information, the step S03 is executed.
It should be noted that, in order to avoid occupying the port of the server where the program is located, only one socket connection is established with the same file storage server in this embodiment. In the specific implementation, after the socket connection is established with the file storage server A, the information corresponding to the file storage server A is stored in a connection list, the connection is sequentially established with the file storage servers corresponding to the tasks according to the sequence of the remote transmission task list, if the file storage servers corresponding to a plurality of tasks are the same, the establishment is only needed once, and the data can be directly transmitted to the file storage server at the opposite end through the connected socket subsequently. Further, when the connected device information includes the peer device information, the step S04 is executed, and accordingly, after the step S06, the method includes: and determining a built socket connection corresponding to the target remote transmission task, and sending the target data to be transmitted to a file storage server corresponding to the target remote transmission task through the built socket connection.
The embodiment obtains a remote transmission task list comprising a plurality of remote transmission tasks; sequentially determining target remote transmission tasks according to the sequence of the remote transmission task list; establishing a target socket connection with a file storage server corresponding to the target remote transmission task; acquiring a target file to be sent corresponding to a target remote transmission task; reading a binary stream of a target file to be sent through target socket connection, and storing the binary stream into a corresponding target preset memory; acquiring a target file byte stream from a target preset memory, and converting the target file byte stream into target data to be transmitted according to a preset file storage protocol; and sending the target data to be transmitted to a file storage server corresponding to the target remote transmission task. By the method, the sockets are used for carrying out remote file transmission by using a preset file storage protocol, batch processing is carried out on a plurality of remote transmission tasks, target socket connection is established with a plurality of file storage servers, only one port is fixedly occupied by the connection between the server where the program is located and each file storage server, and the theoretical value of the concurrent request energy which can be processed is hardly influenced.
In addition, an embodiment of the present invention further provides a storage medium, where a remote file transmission program is stored on the storage medium, and the remote file transmission program, when executed by a processor, implements the remote file transmission method as described above.
Since the storage medium adopts all technical solutions of all the above embodiments, at least all the beneficial effects brought by the technical solutions of the above embodiments are achieved, and details are not repeated herein.
Referring to fig. 4, fig. 4 is a block diagram illustrating a first embodiment of a remote file transfer device according to the present invention.
As shown in fig. 4, a remote file transmission apparatus according to an embodiment of the present invention includes:
a connection module 10 for creating a socket connection with the target file storage server.
The reading module 20 is configured to read a binary stream of a file to be sent, and store the binary stream in a preset memory.
The conversion module 30 is configured to obtain a file byte stream from the preset memory, and convert the file byte stream into data to be transmitted according to a preset file storage protocol.
A sending module 40, configured to send the data to be transmitted to the target file storage server through the socket connection.
It should be understood that the above is only an example, and the technical solution of the present invention is not limited in any way, and in a specific application, a person skilled in the art may set the technical solution as needed, and the present invention is not limited thereto.
The embodiment creates a socket connection with the target file storage server; reading a binary stream of a file to be sent through socket connection, and storing the binary stream into a preset memory; acquiring a file byte stream from a preset memory, and converting the file byte stream into data to be transmitted according to a preset file storage protocol; and sending the data to be transmitted to a target file storage server. By the method, the socket is used for carrying out remote file transmission by using the preset file storage protocol, only one port is fixedly occupied on the server where the program is located, and the theoretical value of the quantity of the concurrent requests which can be processed is hardly influenced.
It should be noted that the above-described work flows are only exemplary, and do not limit the scope of the present invention, and in practical applications, a person skilled in the art may select some or all of them to achieve the purpose of the solution of the embodiment according to actual needs, and the present invention is not limited herein.
In addition, the technical details that are not described in detail in this embodiment may refer to the remote file transmission method provided in any embodiment of the present invention, and are not described herein again.
In an embodiment, the conversion module 30 is further configured to obtain a file byte stream from the preset memory, and determine a data length corresponding to the file byte stream; converting the data length into a length character string according to a preset conversion strategy; and splicing the preset behavior code, the length character string and the file byte stream according to a preset file storage protocol to obtain data to be transmitted.
In an embodiment, the conversion module 30 is further configured to perform binary conversion on the data length to obtain a current character string; and carrying out standardization processing on the current character string according to a preset byte number to obtain a length character string, wherein the byte number of the length character string is consistent with the preset byte number.
In an embodiment, the connection module 10 is further configured to obtain returned exception information; and sending out prompt information of abnormal connection when the abnormal information is detected not to be empty.
In an embodiment, the reading module 20 is further configured to obtain a preset file path; judging whether a file to be sent exists in the preset file path or not; if yes, executing a step of reading a binary stream of the file to be sent and storing the binary stream into a preset memory; if not, sending out an error prompt message.
In one embodiment, the remote file transfer device further comprises a task allocation module;
the task allocation module is used for acquiring a remote transmission task list comprising a plurality of remote transmission tasks; sequentially determining target remote transmission tasks according to the sequence of the remote transmission task list;
the connection module 10 is further configured to create a target socket connection with the file storage server corresponding to the target remote transmission task;
the reading module 20 is further configured to obtain a target file to be sent corresponding to the target remote transmission task; reading the binary stream of the target file to be sent, and storing the binary stream into a corresponding target preset memory;
the conversion module 30 is further configured to obtain a target file byte stream from the target preset memory, and convert the target file byte stream into target to-be-transmitted data according to a preset file storage protocol;
the sending module 40 is further configured to send the target data to be transmitted to a file storage server corresponding to the target remote transmission task through the target socket connection.
In an embodiment, the connection module 10 is further configured to obtain a current connection list, and determine information of a connected device according to the current connection list; determining opposite terminal equipment information corresponding to the target remote transmission task; and when the connected device information does not contain the opposite-end device information, executing the step of establishing target socket connection by the file storage server corresponding to the target remote transmission task.
Further, it is to be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solution of the present invention or portions thereof that contribute to the prior art may be embodied in the form of a software product, where the computer software product is stored in a storage medium (e.g. Read Only Memory (ROM)/RAM, magnetic disk, optical disk), and includes several instructions for enabling a terminal device (e.g. a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.
Claims (10)
1. A remote file transmission method, characterized in that the remote file transmission method comprises:
creating a socket connection with a target file storage server;
reading a binary stream of a file to be sent, and storing the binary stream into a preset memory;
acquiring a file byte stream from the preset memory, and converting the file byte stream into data to be transmitted according to a preset file storage protocol;
and sending the data to be transmitted to the target file storage server through the socket connection.
2. The remote file transmission method according to claim 1, wherein the obtaining a file byte stream from the preset memory, and converting the file byte stream into data to be transmitted according to a preset file storage protocol, comprises:
acquiring a file byte stream from the preset memory, and determining the data length corresponding to the file byte stream;
converting the data length into a length character string according to a preset conversion strategy;
and splicing the preset behavior code, the length character string and the file byte stream according to a preset file storage protocol to obtain data to be transmitted.
3. The remote file transfer method of claim 2, wherein said converting said data length into a length string according to a predetermined conversion policy comprises:
carrying out binary conversion on the data length to obtain a current character string;
and carrying out standardization processing on the current character string according to a preset byte number to obtain a length character string, wherein the byte number of the length character string is consistent with the preset byte number.
4. The remote file transfer method of claim 1, wherein after the socket connection is created with the target file storage server, the method further comprises:
acquiring returned abnormal information;
and sending out prompt information of abnormal connection when the abnormal information is detected not to be empty.
5. The method for remote file transmission according to claim 1, wherein before reading the binary stream of the file to be transmitted and storing the binary stream in a preset memory, the method further comprises:
acquiring a preset file path;
judging whether a file to be sent exists in the preset file path or not;
if yes, executing a step of reading a binary stream of the file to be sent and storing the binary stream into a preset memory;
if not, sending out error prompt information.
6. The remote file transfer method of any one of claims 1-5, wherein the method further comprises:
acquiring a remote transmission task list comprising a plurality of remote transmission tasks;
sequentially determining target remote transmission tasks according to the sequence of the remote transmission task list;
establishing a target socket connection with a file storage server corresponding to the target remote transmission task;
acquiring a target file to be sent corresponding to the target remote transmission task;
reading the binary stream of the target file to be sent, and storing the binary stream into a corresponding target preset memory;
acquiring a target file byte stream from the target preset memory, and converting the target file byte stream into target data to be transmitted according to a preset file storage protocol;
and sending the target data to be transmitted to a file storage server corresponding to the target remote transmission task through the target socket connection.
7. A remote file transfer method as recited in claim 6, wherein prior to the file storage server corresponding to the target remote transfer task creating a target socket connection, the method further comprises:
acquiring a current connection list, and determining information of connected equipment according to the current connection list;
determining opposite terminal equipment information corresponding to the target remote transmission task;
and when the connected device information does not contain the opposite-end device information, executing the step of establishing target socket connection by the file storage server corresponding to the target remote transmission task.
8. A remote file transfer apparatus, comprising:
the connection module is used for establishing socket connection with the target file storage server;
the reading module is used for reading the binary stream of the file to be sent and storing the binary stream into a preset memory;
the conversion module is used for acquiring the file byte stream from the preset memory and converting the file byte stream into data to be transmitted according to a preset file storage protocol;
and the sending module is used for sending the data to be transmitted to the target file storage server through the socket connection.
9. A remote file transfer device, the device comprising: a memory, a processor, and a remote file transfer program stored on the memory and executable on the processor, the remote file transfer program configured to implement the remote file transfer method of any of claims 1 to 7.
10. A storage medium having stored thereon a remote file transfer program which, when executed by a processor, implements a remote file transfer method according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210035914.6A CN114448974B (en) | 2022-01-13 | 2022-01-13 | Remote file transmission method, device, equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210035914.6A CN114448974B (en) | 2022-01-13 | 2022-01-13 | Remote file transmission method, device, equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114448974A true CN114448974A (en) | 2022-05-06 |
CN114448974B CN114448974B (en) | 2024-04-02 |
Family
ID=81368410
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210035914.6A Active CN114448974B (en) | 2022-01-13 | 2022-01-13 | Remote file transmission method, device, equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114448974B (en) |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR20040024946A (en) * | 2002-09-18 | 2004-03-24 | 에스비에스골프닷컴 주식회사 | Method for managing secret key based on public key structure |
CN106301959A (en) * | 2016-10-10 | 2017-01-04 | 烽火通信科技股份有限公司 | Gateway batch upgrading method based on WINDOWS and LINUX platform and system |
CN106657135A (en) * | 2017-01-12 | 2017-05-10 | 上海艾讯云计算有限公司 | File transfer method and equipment based on SSL (Secure Socket Layer) protocol authentication |
CN108306934A (en) * | 2017-12-28 | 2018-07-20 | 北京天元创新科技有限公司 | A kind of cross-server document transmission method and system |
CN110099104A (en) * | 2019-04-12 | 2019-08-06 | 平安科技(深圳)有限公司 | Document transmission method, system and storage medium |
CN110611718A (en) * | 2019-10-08 | 2019-12-24 | 深圳市九洲电器有限公司 | File transmission method, device, server and storage medium |
CN113542402A (en) * | 2021-07-13 | 2021-10-22 | 奇安信科技集团股份有限公司 | File transmission method, device, system, electronic equipment and storage medium |
CN113760799A (en) * | 2020-06-03 | 2021-12-07 | 中车株洲电力机车研究所有限公司 | Extensible communication method and device of UPP interface, computer equipment and storage medium |
-
2022
- 2022-01-13 CN CN202210035914.6A patent/CN114448974B/en active Active
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR20040024946A (en) * | 2002-09-18 | 2004-03-24 | 에스비에스골프닷컴 주식회사 | Method for managing secret key based on public key structure |
CN106301959A (en) * | 2016-10-10 | 2017-01-04 | 烽火通信科技股份有限公司 | Gateway batch upgrading method based on WINDOWS and LINUX platform and system |
CN106657135A (en) * | 2017-01-12 | 2017-05-10 | 上海艾讯云计算有限公司 | File transfer method and equipment based on SSL (Secure Socket Layer) protocol authentication |
CN108306934A (en) * | 2017-12-28 | 2018-07-20 | 北京天元创新科技有限公司 | A kind of cross-server document transmission method and system |
CN110099104A (en) * | 2019-04-12 | 2019-08-06 | 平安科技(深圳)有限公司 | Document transmission method, system and storage medium |
CN110611718A (en) * | 2019-10-08 | 2019-12-24 | 深圳市九洲电器有限公司 | File transmission method, device, server and storage medium |
CN113760799A (en) * | 2020-06-03 | 2021-12-07 | 中车株洲电力机车研究所有限公司 | Extensible communication method and device of UPP interface, computer equipment and storage medium |
CN113542402A (en) * | 2021-07-13 | 2021-10-22 | 奇安信科技集团股份有限公司 | File transmission method, device, system, electronic equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN114448974B (en) | 2024-04-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR101162786B1 (en) | A system and method of managing connections with an available network | |
CN100578942C (en) | System and method for compression of wireless applications expressed in a structured definition language | |
US20040208177A1 (en) | Semiconductor circuit device, packet processing method, management system, management method and packet processing method | |
CN113259479B (en) | Data processing method and equipment | |
CN108737529B (en) | SCA waveform control method, apparatus, computer device and storage medium | |
CN110661853A (en) | Data proxy method, device, computer equipment and readable storage medium | |
US20180198870A1 (en) | Information processing apparatus, method for controlling the same, non-transitory computer-readable storage medium, and information processing system | |
CN113064742A (en) | Message processing method, device, equipment and storage medium | |
CN111901157A (en) | Service deployment method, device, equipment and medium based on k8s | |
CN103944961A (en) | Application sharing method, device and system | |
JP4894680B2 (en) | Electronic device, external device, device system, status information transmission method | |
CN114448974A (en) | Remote file transmission method, device, equipment and storage medium | |
CN113220481A (en) | Request processing and feedback method and device, computer equipment and readable storage medium | |
CN111953497A (en) | Message authentication code generation device and method based on HMAC algorithm | |
US20160266912A1 (en) | External devices, electronic devices, methods for starting external devices, and methods for data processing | |
CN114422164B (en) | Five-tuple table entry issuing device and method | |
CN113922972B (en) | Data forwarding method and device based on MD5 identification code | |
CN115454362A (en) | Method, device and equipment for realizing remote printing and storage medium | |
CN113296987A (en) | Interface calling method and device for calling module, computer equipment and storage medium | |
CN112905273A (en) | Service calling method and device | |
CN113177202A (en) | Data calling method and system, double-chip sales terminal and readable storage medium | |
CN109450885B (en) | Network data interception method and device, electronic equipment and storage medium | |
CN114390088B (en) | Interaction method and device of EDPS (electronic data transfer protocol) through OPC UA client and OPC UA server | |
CN112416619A (en) | Interface configuration method, equipment, terminal and storage medium | |
CN112287265A (en) | Asynchronous event driven based file conversion method and system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |