CN115941675A - UDP (user Datagram protocol) large file message sending method, system, device and medium - Google Patents
UDP (user Datagram protocol) large file message sending method, system, device and medium Download PDFInfo
- Publication number
- CN115941675A CN115941675A CN202310238447.1A CN202310238447A CN115941675A CN 115941675 A CN115941675 A CN 115941675A CN 202310238447 A CN202310238447 A CN 202310238447A CN 115941675 A CN115941675 A CN 115941675A
- Authority
- CN
- China
- Prior art keywords
- file
- data
- sending
- udp
- reading
- 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
Images
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a UDP large file message sending method, a UDP large file message sending system, a UDP large file message sending device and a UDP large file message sending medium, which relate to the technical field of computer network data communication.A first threshold value is determined according to CPU computing power, a large file is read into a read cache queue in a segmented mode, then real-time segmented sending is carried out according to the file recorded in the read cache queue, and the stopping of the file reading step is controlled by a thread monitoring step, so that segmented pre-reading of the large file and real-time sending of the read data are realized, the waste of server resources caused by the overlarge file to be transmitted is avoided, and the file transmission efficiency is improved; meanwhile, the radar file is matched through the characteristics acquired by the radar scanning, so that the size of the file sent by the radar recording terminal is reduced, the radar data transmission efficiency is improved, the matched data is subjected to smoothing processing, the accuracy of the radar data is improved, and the method has good practicability.
Description
Technical Field
The invention relates to the field of computer network data communication, in particular to a UDP (user Datagram protocol) large file message sending method, a system, a device and a medium.
Background
The file transmission is a process of transmitting files from one computer system to another computer system, and is a core technical key point of a computer network system. In the traditional file transmission process, a sending end system firstly reads a file to be sent into an internal memory, then analyzes the file in the internal memory, and finally sends the analyzed file to a receiving end through a network communication protocol. The network communication protocol, i.e. the rules and conventions that must be followed by two entities to complete communication or service, defines the format used by the data unit and the contents such as information and meaning that the information unit should contain, and the commonly used communication protocols include the TCP protocol and the UDP protocol, where the TCP protocol is suitable for an application environment with a high requirement on data reliability and the UDP protocol is suitable for an application environment with a high requirement on data transmission speed. Because the radar file has the characteristics of large file data volume and high requirement on transmission timeliness, the transmission of the radar file is usually realized by adopting a UDP protocol. However, the conventional file transmission method needs to completely load the file into the memory, which results in that a large amount of server resources need to be consumed to complete temporary storage of the file when processing the large file, and the time and cost required for loading the large file into the memory are high, which greatly wastes the CPU performance, affects the timeliness of file transmission, and cannot meet the requirement of radar file transmission.
Disclosure of Invention
In order to avoid waste of server resources caused by overlarge files in the radar file transmission process and reduce time consumption for reading large files to a memory, thereby improving the file transmission efficiency, the invention provides a UDP large file message sending method, which comprises the following steps:
a file obtaining step, comprising: obtaining a first file, and calculating according to the first file and the CPU computing power to obtain a first threshold value;
a file reading step, comprising: step 1: reading the first file in a segmentation mode according to the first threshold value to obtain first data, and storing the first data into a reading buffer queue;
step 2: judging whether a first stop instruction is received or not, if so, stopping the file reading step; if not, returning to execute the step 1;
a file sending step, comprising: step a: acquiring data in a read buffer queue, sending the data through UDP (user Datagram protocol), and recording the sent data volume in a sending buffer;
step b: judging whether a second stop instruction is received or not, and if so, stopping the file sending step; if not, returning to execute the step a;
thread monitoring step, including: judging the data volume of the first file and the data volume of the read cache queue, and if the data volume of the first file and the data volume of the read cache queue are equal, sending a first stop instruction; and if the data volume of the first file is equal to the data volume of the sending cache, sending a second stop instruction.
The method comprises the following steps: after the first file is obtained in the file obtaining step, calculating according to the calculation force of a CPU (Central processing Unit) to obtain a first threshold value for limiting the size of the read file; the file reading step reads the file in a segmentation mode according to the first threshold value and writes the read file into a read cache queue; the file sending step carries out real-time segmented sending according to the files recorded in the reading cache queue, and the thread monitoring step controls the stopping of the file reading step, thereby realizing segmented pre-reading of large files and real-time sending of read data, avoiding the waste of server resources caused by overlarge files needing to be transmitted, improving the efficiency of file transmission and having good practicability.
Furthermore, because the file sending step completes the sending of large files according to the data stored in the read cache queue, the problem that the data in the read cache queue is accumulated due to the excessively low sending speed of the file sending step in the actual sending process is avoided, so that the system is crashed; meanwhile, in order to avoid that the sending speed of the file sending step is too high, so that the read cache queue does not have enough data to be sent, and the integrity of the sent data stream is damaged, the thread monitoring step further comprises the steps of determining a fourth threshold, calculating the ratio of the data amount in the sending cache to the data amount in the read cache queue, and controlling the starting or the suspension of the file reading step according to the size relationship between the ratio and the fourth threshold, so that the thread monitoring step realizes the real-time supplement of the data in the read cache array by controlling the starting or the suspension of the file reading step.
Furthermore, the UDP protocol is a connectionless communication protocol, that is, the UDP does not need to establish a connection before data transmission, so that the transmission speed is high, the transmission delay is small, but due to the connectionless transmission characteristic of the UDP protocol, packet loss may occur when the UDP transmits data, and when packet loss occurs in the UDP transmitting data, the entire data packet needs to be retransmitted; therefore, in order to avoid an increase in transmission time caused by retransmitting the entire data packet when the UDP transmission data is lost, the step a specifically includes:
step I: establishing a sending cache and determining a second threshold value, wherein the second threshold value represents the size of a single UDP message;
step II: determining an initial position, establishing a file pointer in the read cache queue according to the initial position and the second threshold, and reading data of the read cache queue in a segmented mode according to the file pointer to obtain at least one piece of second data;
step III: sequentially carrying out UDP transmission on each second data, and recording the transmitted data volume in the transmission cache; therefore, after the file transmission sequentially performs UDP transmission on each second data, if packet loss occurs, only a single second data needs to be retransmitted, and the whole data packet does not need to be retransmitted, so that the data transmission efficiency is improved.
Further, after segmenting the data in the read buffer queue according to the second threshold, incomplete second data may exist at the end of the segmentation result, and in order to ensure the integrity of the data stream, the incomplete data needs to be discarded, and after new data is written in the read buffer queue, the data is uniformly sent, so that after at least one second data is obtained, the step II further includes:
judging whether incomplete data exists in the second data or not;
if the incomplete data exist, the incomplete data are abandoned, and the initial position is updated; because the file reading step and the file sending step are executed in parallel, the initial position is updated by the file sending step according to the reading condition every time, and the influence on the integrity of data stream caused by sending incomplete messages is avoided.
Furthermore, the radar transmits a ray from the center O at intervals of a fixed angle clockwise or counterclockwise by taking a point O as a circle center and a fixed distance R as a radius, and determines a monitoring point at intervals of a fixed distance d for each ray to obtain a corresponding monitoring value, so that a radar file obtained by a radar terminal contains a large amount of descriptive data, resulting in a huge data volume of the finally obtained radar file.
In order to reduce the size of a file sent by a radar recording terminal and improve the radar data transmission efficiency, after the radar recording terminal obtains a radar file, firstly matching monitoring values on the same monitoring points within a period of time according to data recorded in the radar file, and then sending the matched data together, therefore, the UDP large file message sending method further comprises the following steps:
file identification step, including: acquiring a file to be sent, wherein data in the file to be sent comprises time data and first position data, the time data is used for describing the time for starting scanning of a radar, and the first position data is used for describing the starting direction of scanning of the radar;
matching the file to be sent according to the time data and the position data to obtain a matching result;
and processing the file to be sent according to the matching result to obtain the first file.
Furthermore, the descriptive information obtained by the radar for each monitoring point comprises data such as longitude and latitude, distance, direction, speed, movement direction and the like, because the state of the monitoring point changes in real time, the descriptive information obtained by the radar scanning the same monitoring point twice may change, and the change condition of the monitoring point can be obtained by calculating the data difference of the same monitoring point obtained by the radar; meanwhile, as the radar is analyzed according to monitoring values corresponding to a plurality of monitoring points, data contained in a radar file can be regarded as a dot matrix formed by a plurality of data points, when a range covered by the dot matrix is detected through the radar, the state change conditions of adjacent monitoring points in a period of time are similar, monitoring points with large data variation difference with the adjacent monitoring points in the period of time are represented as isolated points in the dot matrix, and the dirty data are generated due to system detection errors, so that in order to screen out dirty data in the radar data, the data change characteristics of the radar data monitoring points are accurately obtained, the file to be sent also comprises characteristic data and second position data, the characteristic data is used for describing the data characteristics of the radar points, and the second position data is used for describing the positions of the radar detection points; processing the file to be sent according to the matching result to obtain the first file, which specifically includes:
processing the feature data according to the matching result to obtain at least one feature group;
traversing the feature group, and performing smoothing processing on the feature group according to the second position data to obtain the first file.
Further, traversing the feature group, and performing smoothing processing on the feature group according to the second position data to obtain the first file specifically includes:
calculating a first variable quantity of feature data in any one feature group x in the feature groups according to the time data;
because the state change conditions of the adjacent monitoring points in a period of time are similar, at least one adjacent feature group corresponding to the feature group x is obtained according to the second position data, and a second variable quantity corresponding to the adjacent feature group is obtained;
calculating a convolution sum of the first variable quantity and the second variable quantity, and updating the first variable quantity according to the convolution sum;
the steps are repeatedly executed until the processing of each feature group is finished, and according to the convolution and the updating of the first variable quantity, abnormal change values in the feature groups can be screened out, namely points with great feature data change and points with small feature data change are screened out, so that the accuracy of the data is effectively improved, and finally the first file is obtained.
Further, since the size of the first file obtained in the file obtaining step is uncertain during actual use, in a case where the CPU usage rate is low, it is acceptable to directly read and transmit the first file exceeding a certain range of CPU computation power in order to save programs, and therefore, the file obtaining step is specifically:
determining a third threshold value, obtaining the first file, and judging the size of the first file;
if the first file is larger than the third threshold value, starting a file reading step, and calculating according to the first file and the CPU calculation power to obtain a first threshold value;
and if the first file is smaller than the third threshold value, reading the first file and sending the first file through UDP.
In order to achieve the above object, the present invention provides a UDP large file packet sending system, including:
a file obtaining unit for obtaining a first file, calculating according to the first file and CPU calculation power, and obtaining a first threshold value
The file reading unit is used for reading the first file in a segmentation mode according to the first threshold value to obtain first data, and storing the first data into a reading cache queue; judging whether a first stop instruction is received or not, and if so, stopping the file reading unit; if not, continuously reading the first file in a segmentation mode according to the first threshold value and executing subsequent steps;
the file sending unit is used for acquiring the data in the reading buffer queue, sending the data through UDP (user Datagram protocol), and recording the sent data volume in the sending buffer; judging whether a second stop instruction is received or not, and if so, stopping the file sending unit; if not, continuously acquiring the data in the read cache queue, sending the data through UDP and executing the subsequent steps;
the thread monitoring unit is used for judging the data volume of the first file and the data volume of the read cache queue, and if the data volume of the first file is equal to the data volume of the read cache queue, a first stop instruction is sent; and sending a second stop instruction if the data volume of the first file is equal to the data volume of the sending cache.
Wherein, the principle of this system does: after the file obtaining unit obtains the first file, calculating according to the CPU calculation force to obtain a first threshold value for limiting the size of the read file; the file reading unit reads the file in a segmented mode according to the first threshold value and writes the read file into a read cache queue; the file sending unit carries out real-time segmented sending according to the files recorded in the reading cache queue, and the thread monitoring unit controls the stopping of the file reading step, so that segmented pre-reading of large files and real-time sending of read data are realized, the waste of server resources caused by overlarge files needing to be transmitted is avoided, the efficiency of file transmission is improved, and the thread monitoring unit has good practicability.
In order to achieve the above object, the present invention provides a UDP large file message sending apparatus, including a memory, a processor, and a computer program stored in the memory and operable on the processor, where the processor implements any one of the steps of the UDP large file message sending method when executing the computer program.
To achieve the above object, the present invention provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the computer program implements any one of the steps of the UDP large file message sending method.
One or more technical schemes provided by the invention at least have the following technical effects or advantages: determining a first threshold value according to the CPU computing power, reading a large file to a reading cache queue in a segmented manner, performing real-time segmented transmission according to the file recorded in the reading cache queue in the file transmitting step, and controlling the stop of the file reading step by the thread monitoring step, so that segmented pre-reading of the large file and real-time transmission of read data are realized, the waste of server resources caused by overlarge files needing to be transmitted is avoided, and the file transmission efficiency is improved; meanwhile, the radar file is matched through the characteristics acquired by the radar scanning, so that the size of the file sent by the radar recording terminal is reduced, the radar data transmission efficiency is improved, the matched data is subjected to smoothing processing, the accuracy of the radar data is improved, and the method has good practicability.
Drawings
The accompanying drawings, which are included to provide a further understanding of the embodiments of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain the principles of the invention;
FIG. 1 is a schematic diagram of a UDP large file message transmission flow in the present invention;
fig. 2 is a schematic diagram of the structure of a UDP large file messaging system in the present invention.
Detailed description of the preferred embodiments
In order that the above objects, features and advantages of the present invention can be more clearly understood, a more particular description of the invention will be rendered by reference to the appended drawings. It should be noted that the embodiments of the present invention and features of the embodiments may be combined with each other without conflicting with each other.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention, however, the present invention may be practiced in other ways than those specifically described and thus the scope of the present invention is not limited by the specific embodiments disclosed below.
Examples
Referring to fig. 1, a UDP large file packet sending method according to an embodiment of the present invention includes the following steps:
a file obtaining step, comprising: obtaining a first file, and calculating according to the first file and CPU calculation power to obtain a first threshold value;
a file reading step, comprising: step 1: reading the first file in a segmentation mode according to the first threshold value to obtain first data, and storing the first data into a reading cache queue;
and 2, step: judging whether a first stop instruction is received or not, and if so, stopping the file reading step; if not, returning to execute the step 1;
a file sending step, comprising: step a: acquiring data in a read buffer queue, sending the data through UDP (user Datagram protocol), and recording the sent data volume in a sending buffer;
step b: judging whether a second stop instruction is received or not, and if so, stopping the file sending step; if not, returning to execute the step a;
thread monitoring step, including: judging the data volume of the first file and the data volume of the read cache queue, and if the data volume of the first file and the data volume of the read cache queue are equal, sending a first stop instruction; and if the data volume of the first file is equal to the data volume of the sending cache, sending a second stop instruction.
The CPU computing power is determined according to the number of CPU cores, the CPU core frequency and the single clock period capacity of the CPU cores in actual application; after the CPU computation power is obtained, a first threshold is obtained according to the data complexity of the first file and the CPU computation power, where the CPU computation power and the first threshold are determined according to specific conditions of use, and this embodiment is not specifically limited herein.
Specifically, when the thread monitoring step monitors that the data volume of the first file is equal to the data volume of the read cache queue, the file reading step is considered to have finished reading the first file, and in order to save server resources, a first stop instruction is sent to control the closing of the thread corresponding to the file reading step; when the thread monitoring step monitors that the data volume of the first file is equal to the data volume of the sending cache, the file sending step is considered to finish sending the first file, and a second stop instruction is sent to save server resources and control the thread corresponding to the file sending step to be closed; when the file obtaining step obtains a new file, the thread corresponding to the file reading step and the file sending step is started first, and then calculation is carried out according to the new file and the CPU calculation power to obtain a new first threshold value.
In this embodiment, the thread monitoring step further includes determining a fourth threshold, calculating a ratio of data amounts in the sending buffer and the reading buffer, and controlling the starting or the suspending of the file reading step according to a size relationship between the ratio and the fourth threshold.
The ratio of the data volume in the sending buffer and the data volume in the reading buffer queue is used for describing the size relationship between the sent data volume and the read data volume; in order to avoid that the sending speed of the file sending step is too low, which causes data accumulation in the read cache queue, thereby causing system crash, and in order to avoid that the sending speed of the file sending step is too high, which causes that the read cache queue does not have enough data to be sent, which damages the integrity of a sent data stream, the thread monitoring step controls the starting or the suspension of the file reading step by judging the size relationship between the ratio and the fourth threshold.
Specifically, if the ratio is smaller than the fourth threshold, it is determined that the sending speed of the current file sending step is relatively low, and enough data to be sent exists in the read cache queue, so as to avoid data accumulation in the read cache queue, the thread monitoring step controls the file reading step to pause; if the ratio is greater than the fourth threshold, it is determined that the sending speed of the current file sending step is fast, and there is not enough data to be sent in the read buffer queue, so as to avoid that there is no data in the read buffer queue for sending and the integrity of the sending data stream is damaged, the thread monitoring step controls the file reading step to start, where the size of the fourth threshold is determined according to actual needs, and this embodiment is not specifically limited herein.
The size of the second threshold is determined according to the rate of UDP transmission in the file transmission step in actual use, which is not specifically limited herein.
In this embodiment, the step a specifically includes:
step I: establishing a sending cache and determining a second threshold value, wherein the second threshold value represents the size of a single UDP message;
step II: determining an initial position, establishing a file pointer in the read cache queue according to the initial position and the second threshold, and reading data of the read cache queue in a segmented manner according to the file pointer to obtain at least one piece of second data;
step III: and sequentially carrying out UDP transmission on each second data, and recording the transmitted data volume in the transmission cache.
Specifically, after the initial position is determined in the step II, a pointer is established in the read buffer queue according to the initial position, the pointer is moved according to the second threshold, and second data is read in the read buffer queue according to corresponding positions before and after the pointer is moved; repeating the steps until all data in the read cache queue are read, and obtaining at least one second data; writing each second data into a UDP message in sequence and sending the second data, and recording the sent data volume in the sending cache; the size of the second threshold is determined according to actual needs, and this embodiment is not specifically limited herein.
In this embodiment, after obtaining at least one piece of the second data, the step II further includes:
judging whether incomplete data exists in the second data or not;
and if the incomplete data exist, discarding the incomplete data, and updating the starting position.
In this embodiment, the file obtaining step specifically includes:
determining a third threshold value, obtaining the first file, and judging the size of the first file;
if the first file is larger than the third threshold value, starting a file reading step, and calculating according to the first file and the CPU computing power to obtain a first threshold value;
and if the first file is smaller than the third threshold value, reading the first file and sending the first file through UDP.
The third threshold is used to determine whether the first file needs to be read in a segmented manner, and the size of the third threshold is determined according to actual needs, which is not specifically limited in this embodiment.
Examples
Referring to fig. 1, a second embodiment of the present invention provides a UDP large file packet sending method, where on the basis of the first embodiment, the UDP large file packet sending method further includes:
file identification step, including: acquiring a file to be sent, wherein data in the file to be sent comprises time data and first position data, the time data is used for describing the time for starting scanning of a radar, and the first position data is used for describing the starting direction of scanning of the radar;
matching the file to be sent according to the time data and the position data to obtain a matching result;
and processing the file to be sent according to the matching result to obtain the first file.
Specifically, the radar takes a point O as a circle, takes a fixed distance R as a radius, sends a ray from a circle center O clockwise or anticlockwise at intervals of a fixed angle alpha, determines a monitoring point m by taking a fixed distance d as an interval for each ray, obtains a corresponding monitoring value n, and sends a corresponding monitoring value n to any monitoring point m 1 Having a coordinate of (beta) 1 ,l 1 ) Wherein, β 1 Represents the center of a circle O to a monitoring point m 1 Angle between the ray and the radar starting scan direction, l 1 Represents a monitoring point m 1 And completing the matching of the monitoring points with the same coordinate in the file to be sent according to the time data and the position data and obtaining a matching result by the distance from the center of the circle to the O.
After the matching result is obtained, the processing of the file to be sent according to the matching result may be processing manners such as averaging, taking a maximum value, taking a minimum value, and taking a difference value for different monitoring values n corresponding to the same monitoring point according to the matching result, and the specific processing method is determined according to actual needs of radar detection, which is not specifically limited in this embodiment.
In this embodiment, the file to be sent further includes feature data and second location data, where the feature data is used to describe data features of radar detection points, and the second location data is used to describe locations of the radar detection points; processing the file to be sent according to the matching result to obtain the first file, which specifically includes:
processing the feature data according to the matching result to obtain at least one feature group;
and traversing the feature group, and performing smoothing processing on the feature group according to the second position data to obtain the first file.
The characteristic data is used for describing data characteristics of radar monitoring points, specific data types are determined according to targets detected by an actual radar, and the embodiment is not particularly limited herein; any one feature group includes at least two feature data, and the number of the feature data is determined according to the number of times of scanning the same monitoring point by the radar in actual use, which is not specifically limited herein.
In this embodiment, traversing the feature group, and performing smoothing processing on the feature group according to the second position data to obtain the first file specifically includes:
calculating a first variable quantity of feature data in any one feature group x in the feature groups according to the time data;
obtaining at least one adjacent feature group corresponding to the feature group x according to the second position data, and obtaining a second variation corresponding to the adjacent feature group;
calculating a convolution sum of the first variable quantity and the second variable quantity, and updating the first variable quantity according to the convolution sum;
and repeatedly executing the steps until the processing of each feature group is finished, and obtaining the first file.
Examples
Referring to fig. 2, a third embodiment of the present invention provides a UDP large file packet sending system, where the system includes:
a file obtaining unit for obtaining a first file, calculating according to the first file and CPU calculation power, and obtaining a first threshold value
The file reading unit is used for reading the first file in a segmentation mode according to the first threshold value to obtain first data, and storing the first data into a reading cache queue; judging whether a first stop instruction is received or not, and if so, stopping the file reading unit; if not, continuously reading the first file in a segmentation mode according to the first threshold value and executing subsequent steps;
the file sending unit is used for acquiring the data in the reading buffer queue, sending the data through UDP (user Datagram protocol), and recording the sent data volume in the sending buffer; judging whether a second stop instruction is received or not, if so, stopping the file sending unit; if not, continuously acquiring the data in the read cache queue, sending the data through UDP and executing the subsequent steps;
the thread monitoring unit is used for judging the data volume of the first file and the data volume of the read cache queue, and if the data volume of the first file and the data volume of the read cache queue are equal, a first stop instruction is sent; and if the data volume of the first file is equal to the data volume of the sending cache, sending a second stop instruction.
Examples
The fourth embodiment of the present invention provides a UDP large file message sending apparatus, including a memory, a processor, and a computer program stored in the memory and operable on the processor, where the processor implements the step of sending the UDP large file message when executing the computer program.
Examples
The fifth embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the steps of the UDP large file message sending method are implemented.
The processor may be a central processing unit, or may be other general-purpose processor, a digital signal processor, an application specific integrated circuit, an off-the-shelf programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, or the like. The general purpose processor may be a microprocessor or any conventional processor.
The memory can be used for storing the computer program and/or the module, and the processor realizes various functions of the UDP large file message sending device by operating or executing the data stored in the memory. The memory may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function, and the like. Further, the memory may include high speed random access memory, and may also include non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card, a secure digital card, a flash memory card, at least one magnetic disk storage device, a flash memory device, or other volatile solid state storage device.
The UDP large file message transmission apparatus may be stored in a computer readable storage medium if it is implemented in the form of a software functional unit and sold or used as a separate product. Based on such understanding, all or part of the flow of the method of the embodiments described above can be realized by the present invention, and the computer program can also be stored in a computer readable storage medium, and when the computer program is executed by a processor, the steps of the method embodiments described above can be realized. Wherein the computer program comprises computer program code, an object code form, an executable file or some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying said computer program code, a recording medium, a usb-disk, a removable hard-disk, a magnetic diskette, an optical disk, a computer memory, a read-only memory, a random access memory, a point carrier signal, a telecommunications signal, a software distribution medium, etc. It should be noted that the computer readable medium may contain content that is appropriately increased or decreased as required by legislation and patent practice in the jurisdiction.
While the invention has been described with respect to the basic concepts, it will be apparent to those skilled in the art that the foregoing detailed disclosure is only by way of example and not intended to limit the invention. Various modifications, improvements and adaptations to the present description may occur to those skilled in the art, though not explicitly described herein. Such modifications, improvements and adaptations are proposed in the present specification and thus fall within the spirit and scope of the exemplary embodiments of the present specification.
Also, the description uses specific words to describe embodiments of the description. Reference to "one embodiment," "an embodiment," and/or "some embodiments" means a feature, structure, or characteristic described in connection with at least one embodiment of the specification. Therefore, it is emphasized and should be appreciated that two or more references to "an embodiment" or "one embodiment" or "an alternative embodiment" in various places throughout this specification are not necessarily all referring to the same embodiment. Furthermore, some features, structures, or characteristics of one or more embodiments of the specification may be combined as appropriate.
Moreover, those skilled in the art will appreciate that aspects of the present description may be illustrated and described in terms of several patentable species or situations, including any new and useful combination of processes, machines, manufacture, or materials, or any new and useful improvement thereof. Accordingly, aspects of this description may be performed entirely by hardware, entirely by software (including firmware, resident software, micro-code, etc.), or by a combination of hardware and software. The above hardware or software may be referred to as "data block," module, "" engine, "" unit, "" component, "or" system. Furthermore, aspects of the present description may be represented as a computer product, including computer readable program code, embodied in one or more computer readable media.
The computer storage medium may comprise a propagated data signal with the computer program code embodied therewith, for example, on baseband or as part of a carrier wave. The propagated signal may take any of a variety of forms, including electromagnetic, optical, etc., or any suitable combination. A computer storage medium may be any computer-readable medium that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code located on a computer storage medium may be propagated over any suitable medium, including radio, cable, fiber optic cable, RF, or the like, or any combination of the preceding.
Computer program code required for the operation of various portions of this specification may be written in any one or more programming languages, including an object oriented programming language such as Java, scala, smalltalk, eiffel, JADE, emerald, C + +, C #, VB.NET, python, and the like, a conventional programming language such as C, visual Basic, fortran 2003, perl, COBOL 2002, PHP, ABAP, a dynamic programming language such as Python, ruby, and Groovy, or other programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any network format, such as a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet), or in a cloud computing environment, or as a service, such as a software as a service (SaaS).
Additionally, the order in which the elements and sequences of the process are recited in the specification, the use of alphanumeric characters, or other designations, is not intended to limit the order in which the processes and methods of the specification occur, unless otherwise specified in the claims. While various presently contemplated embodiments of the invention have been discussed in the foregoing disclosure by way of example, it is to be understood that such detail is solely for that purpose and that the appended claims are not limited to the disclosed embodiments, but, on the contrary, are intended to cover all modifications and equivalent arrangements that are within the spirit and scope of the embodiments herein. For example, although the system components described above may be implemented by hardware devices, they may also be implemented by software-only solutions, such as installing the described system on an existing server or mobile device.
Similarly, it should be noted that in the preceding description of embodiments of the present specification, various features are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure aiding in the understanding of one or more of the embodiments. This method of disclosure, however, is not intended to imply that more features than are expressly recited in a claim. Indeed, the embodiments may be characterized as having less than all of the features of a single embodiment disclosed above.
For each patent, patent application publication, and other material, such as articles, books, specifications, publications, documents, etc., cited in this specification, the entire contents of each are hereby incorporated by reference into this specification. Except where the application history document does not conform to or conflict with the contents of the present specification, it is to be understood that the application history document, as used herein in the present specification or appended claims, is intended to define the broadest scope of the present specification (whether presently or later in the specification) rather than the broadest scope of the present specification. It is to be understood that the descriptions, definitions and/or uses of terms in the accompanying materials of this specification shall control if they are inconsistent or contrary to the descriptions and/or uses of terms in this specification.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.
Claims (11)
1. A method for sending UDP large file messages is characterized by comprising the following steps:
a file obtaining step, comprising: obtaining a first file, and calculating according to the first file and CPU calculation power to obtain a first threshold value;
a file reading step, comprising: step 1: reading the first file according to the first threshold value in a segmentation mode to obtain first data, and writing the first data into a read cache queue;
step 2: judging whether a first stop instruction is received or not, and if so, stopping the file reading step; if not, returning to execute the step 1;
a file sending step, comprising: step a: acquiring data in a read buffer queue, sending the data through UDP (user Datagram protocol), and recording the sent data volume in a sending buffer;
step b: judging whether a second stop instruction is received or not, and if so, stopping the file sending step; if not, returning to execute the step a;
thread monitoring step, including: judging the data volume of the first file and the data volume of the read cache queue, and if the data volume of the first file and the data volume of the read cache queue are equal, sending a first stop instruction; and if the data volume of the first file is equal to the data volume of the sending cache, sending a second stop instruction.
2. The UDP large file packet sending method according to claim 1, wherein the thread monitoring step further includes determining a fourth threshold, calculating a ratio of data amounts in the sending buffer and the reading buffer queue, and controlling the starting or the suspending of the file reading step according to a size relationship between the ratio and the fourth threshold.
3. The method for sending UDP large file packets according to claim 1, wherein the step a specifically comprises:
step I: establishing a sending cache and determining a second threshold value, wherein the second threshold value represents the size of a single UDP message;
step II: determining an initial position, establishing a file pointer in the read cache queue according to the initial position and the second threshold, and reading data of the read cache queue in a segmented mode according to the file pointer to obtain at least one piece of second data;
step III: and sequentially carrying out UDP transmission on each second data, and recording the transmitted data volume in the transmission cache.
4. The UDP large file packet sending method according to claim 3, wherein after obtaining at least one of the second data, the step II further includes:
judging whether incomplete data exist in the second data or not;
if the incomplete data exists, the incomplete data is abandoned, and the starting position is updated.
5. The method according to claim 1, wherein the method for sending UDP large file packets further comprises:
file identification step, including: acquiring a file to be sent, wherein data in the file to be sent comprises time data and first position data, the time data is used for describing the time for starting scanning of a radar, and the first position data is used for describing the starting direction of scanning of the radar;
matching the file to be sent according to the time data and the position data to obtain a matching result;
and processing the file to be sent according to the matching result to obtain the first file.
6. The UDP large file packet sending method according to claim 5, wherein the file to be sent further includes feature data and second position data, the feature data is used to describe data features of a radar detection point, and the second position data is used to describe a position of the radar detection point; processing the file to be sent according to the matching result to obtain the first file, which specifically includes:
processing the feature data according to the matching result to obtain at least one feature group;
and traversing the feature group, and performing smoothing processing on the feature group according to the second position data to obtain the first file.
7. The method according to claim 6, wherein traversing the feature group, and performing smoothing processing on the feature group according to the second location data to obtain the first file specifically comprises:
calculating a first variable quantity of feature data in any one feature group x in the feature groups according to the time data;
obtaining at least one adjacent feature group corresponding to the feature group x according to the second position data, and obtaining a second variation corresponding to the adjacent feature group;
calculating a convolution sum of the first variable quantity and the second variable quantity, and updating the first variable quantity according to the convolution sum;
and repeatedly executing the steps until the processing of each feature group is finished, and obtaining the first file.
8. The method for sending UDP large file packets according to claim 1, wherein the file obtaining step specifically is:
determining a third threshold value, obtaining the first file, and judging the size of the first file;
if the first file is larger than the third threshold value, starting a file reading step, and calculating according to the first file and the CPU calculation power to obtain a first threshold value;
and if the first file is smaller than the third threshold value, reading the first file and sending the first file through UDP.
9. A UDP large file messaging system, comprising:
a file obtaining unit for obtaining a first file, calculating according to the first file and CPU calculation power, and obtaining a first threshold value
The file reading unit is used for reading the first file in a segmentation mode according to the first threshold value to obtain first data, and storing the first data into a reading cache queue; judging whether a first stop instruction is received or not, if so, stopping the file reading unit; if not, continuously reading the first file in a segmentation mode according to the first threshold value and executing subsequent steps;
the file sending unit is used for acquiring the data in the reading buffer queue, sending the data through UDP (user Datagram protocol), and recording the sent data volume in the sending buffer; judging whether a second stop instruction is received or not, and if so, stopping the file sending unit; if not, continuously acquiring the data in the read cache queue, sending the data through UDP and executing the subsequent steps;
the thread monitoring unit is used for judging the data volume of the first file and the data volume of the read cache queue, and if the data volume of the first file and the data volume of the read cache queue are equal, a first stop instruction is sent; and if the data volume of the first file is equal to the data volume of the sending cache, sending a second stop instruction.
10. A UDP large file messaging apparatus comprising a memory, a processor, and a computer program stored in said memory and executable on said processor, wherein said processor when executing said computer program performs the steps of the UDP large file messaging method according to any one of claims 1 to 8.
11. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the UDP large file messaging method according to any one of claims 1 to 8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310238447.1A CN115941675B (en) | 2023-03-14 | 2023-03-14 | UDP large file message sending method, system and device and medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310238447.1A CN115941675B (en) | 2023-03-14 | 2023-03-14 | UDP large file message sending method, system and device and medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115941675A true CN115941675A (en) | 2023-04-07 |
CN115941675B CN115941675B (en) | 2023-05-05 |
Family
ID=85827258
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310238447.1A Active CN115941675B (en) | 2023-03-14 | 2023-03-14 | UDP large file message sending method, system and device and medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115941675B (en) |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104580371A (en) * | 2014-12-10 | 2015-04-29 | 北京邮电大学 | Methods of fragmentation, transmission and copy control for file fixed size and changeable size in opportunistic network |
CN110933159A (en) * | 2019-11-27 | 2020-03-27 | 中电装备山东电子有限公司 | File transmission method and system supporting breakpoint continuous transmission |
CN110995796A (en) * | 2019-11-20 | 2020-04-10 | 中国建设银行股份有限公司 | Data transmission method and device based on private line |
CN111147564A (en) * | 2019-12-20 | 2020-05-12 | 国久大数据有限公司 | Data file transmission method, system and communication terminal |
CN114390004A (en) * | 2022-03-24 | 2022-04-22 | 成都数联云算科技有限公司 | Message processing method, system, device and medium |
CN115174561A (en) * | 2022-09-08 | 2022-10-11 | 北京亿赛通网络安全技术有限公司 | File segmented transmission method and system |
CN115396423A (en) * | 2022-07-29 | 2022-11-25 | 五八同城信息技术有限公司 | File transmission method and device, electronic equipment and storage medium |
-
2023
- 2023-03-14 CN CN202310238447.1A patent/CN115941675B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104580371A (en) * | 2014-12-10 | 2015-04-29 | 北京邮电大学 | Methods of fragmentation, transmission and copy control for file fixed size and changeable size in opportunistic network |
CN110995796A (en) * | 2019-11-20 | 2020-04-10 | 中国建设银行股份有限公司 | Data transmission method and device based on private line |
CN110933159A (en) * | 2019-11-27 | 2020-03-27 | 中电装备山东电子有限公司 | File transmission method and system supporting breakpoint continuous transmission |
CN111147564A (en) * | 2019-12-20 | 2020-05-12 | 国久大数据有限公司 | Data file transmission method, system and communication terminal |
CN114390004A (en) * | 2022-03-24 | 2022-04-22 | 成都数联云算科技有限公司 | Message processing method, system, device and medium |
CN115396423A (en) * | 2022-07-29 | 2022-11-25 | 五八同城信息技术有限公司 | File transmission method and device, electronic equipment and storage medium |
CN115174561A (en) * | 2022-09-08 | 2022-10-11 | 北京亿赛通网络安全技术有限公司 | File segmented transmission method and system |
Also Published As
Publication number | Publication date |
---|---|
CN115941675B (en) | 2023-05-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11929985B2 (en) | Network-based authentication rule cleaning and optimization | |
CN110069961B (en) | Object detection method and device | |
CN112988845B (en) | Data information processing method and information service platform in big data service scene | |
CN111625503B (en) | Method and equipment for locally and randomly pre-reading file of distributed file system | |
CN114430307B (en) | Data decoding method, data encoding method, device and terminal equipment | |
CN112433920A (en) | Buried point data reporting method, device, equipment and medium | |
CN107688626A (en) | Slow inquiry log processing method, device and electronic equipment | |
US10747675B2 (en) | Method and device for managing caches | |
CN113312008A (en) | Processing method, system, equipment and medium for file read-write service | |
CN110188815B (en) | Feature point sampling method, device, equipment and storage medium | |
US11928529B2 (en) | High-throughput BPF map manipulations with uprobes | |
CN115941675B (en) | UDP large file message sending method, system and device and medium | |
CN112732560B (en) | Method and device for detecting leakage risk of file descriptor | |
CN111552652B (en) | Data processing method and device based on artificial intelligence chip and storage medium | |
CN113923002A (en) | Computer network intrusion prevention method and device, storage medium and processor | |
CN109842619B (en) | User account intercepting method and device | |
CN115469804B (en) | NVMe multi-queue arbitration method and device | |
CN111078384A (en) | Method and device for migrating core data, computer equipment and storage medium | |
CN114979040B (en) | UDP message writing method, system and device and medium | |
CN106971550A (en) | The detection method and system of intelligent transportation map Bridge | |
CN113380352A (en) | Medical micro-service arrangement-based intermediate language description method and system | |
CN111352868A (en) | Serial port access method and device and terminal equipment | |
CN110795038A (en) | Method, device and equipment for processing modified write request and readable storage medium | |
CN111274118B (en) | Application optimization processing method, device and system | |
CN108805778A (en) | Electronic device, the method and storage medium for acquiring collage-credit data |
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 |