CN116192985B - Data transmission method, device and system - Google Patents

Data transmission method, device and system Download PDF

Info

Publication number
CN116192985B
CN116192985B CN202310100912.5A CN202310100912A CN116192985B CN 116192985 B CN116192985 B CN 116192985B CN 202310100912 A CN202310100912 A CN 202310100912A CN 116192985 B CN116192985 B CN 116192985B
Authority
CN
China
Prior art keywords
data
sent
port
queue
thread
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.)
Active
Application number
CN202310100912.5A
Other languages
Chinese (zh)
Other versions
CN116192985A (en
Inventor
彭万喜
李青
林弟
张常华
朱正辉
赵定金
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Baolun Electronics Co ltd
Original Assignee
Guangdong Baolun Electronics Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Guangdong Baolun Electronics Co ltd filed Critical Guangdong Baolun Electronics Co ltd
Priority to CN202310100912.5A priority Critical patent/CN116192985B/en
Publication of CN116192985A publication Critical patent/CN116192985A/en
Application granted granted Critical
Publication of CN116192985B publication Critical patent/CN116192985B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/50Reducing energy consumption in communication networks in wire-line communication networks, e.g. low power modes or reduced link rate

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention discloses a data transmission method, a device and a system, comprising the following steps: receiving a data packet to be sent, and creating threads and queues; analyzing the data packet to be sent according to the created thread, and storing the analyzed data packet to be sent in the queue; the parsed data packet to be sent comprises: data, a time interval between each piece of data, a source IP port and a target IP port; extracting the data from the queue, and sequentially sending the data to the target IP port according to the time interval between each piece of data; and after the target IP port returns the data result, the data result is sent to the source IP port. The invention avoids the problem that the existing method directly forwards one piece of data which is sent independently, which frequently triggers the process of data forwarding and receiving, further leads to the incapability of circularly sending a plurality of pieces of data, reduces the occurrence of data transmission errors and improves the efficiency and accuracy of data transmission.

Description

Data transmission method, device and system
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a data transmission method, apparatus, and system.
Background
In a network environment, communication between two pieces of internet-of-things equipment is desired, besides using real physical peripheral equipment, each piece of equipment can also communicate through a network, each piece of equipment has own IP in the own network environment, an appointed process in one piece of equipment is determined through an IP+ port, according to a computer network, two pieces of internet-of-things equipment can use a socket at an application layer through adding an own IP port, an IP port of an opposite terminal and information to be transmitted, services provided by a transmission layer are provided through a transmission layer, the transmission layer transmits the services provided by a lower network layer, a data link layer and the physical layer to the physical layer of the opposite terminal through signals, and then the corresponding port numbers are finally reached through analysis of the link layer, the network layer and the transmission layer.
The existing network for transmitting between the internet of things devices can only independently transmit one command (or one data), cannot circularly transmit a plurality of commands or data, and cannot determine the transmission time interval between the data, and the data size is limited, so that the communication efficiency between the internet of things devices is low.
Therefore, a method for improving data communication efficiency is needed.
Disclosure of Invention
The invention provides a data transmission method, a data transmission device and a data transmission system, which are used for solving the technical problem of low data communication efficiency in the prior art.
In order to solve the above technical problems, an embodiment of the present invention provides a data transmission method, including:
receiving a data packet to be sent, and creating threads and queues;
analyzing the data packet to be sent according to the created thread, and storing the analyzed data packet to be sent in the queue; the parsed data packet to be sent comprises: data, a time interval between each piece of data, a source IP port and a target IP port;
extracting the data from the queue, and sequentially sending the data to the target IP port according to the time interval between each piece of data;
and after the target IP port returns the data result, the data result is sent to the source IP port.
Preferably, the receiving the data packet to be sent and creating a thread and a queue specifically include:
responding to all data to be transmitted, time intervals between each piece of data, a source IP port and a target IP port set by a user, packaging to generate a data packet to be transmitted, and reading the data packet to be transmitted;
after reading and receiving the data packet to be sent, creating a thread and a queue; wherein the thread comprises: the first thread, the second thread and the third thread, wherein the queues comprise a first queue, a second queue and a third queue.
As a preferred solution, the parsing the data packet to be sent according to the created thread, and storing the parsed data packet to be sent in the queue, which specifically includes:
analyzing the data packet to be sent through the first thread;
storing the source IP port obtained by analysis in the third queue, and storing the data packet to be transmitted after analysis in the first queue;
and waking up the second thread after the parsed data packet to be sent is completely stored in the first queue.
Preferably, the extracting the data from the queue and sequentially sending the data to the target IP port according to a time interval between each piece of data specifically includes:
after the second thread wakes up, detecting that the parsed data packet to be sent exists in the first queue through the second thread, and taking out all data stored in the first queue, so that the data is sent to a target IP port according to the time interval between each piece of data; the parsed data packet to be sent comprises: data, time intervals between each piece of data, and a target IP port.
As a preferred solution, after the target IP port returns a data result, the sending the data result to the source IP port specifically includes:
after receiving a data result returned by the target IP port through the second thread, storing the data result in a second queue, and waking up the third thread;
and after waking up the third thread, extracting a source IP port stored in a third queue and a data result stored in a second queue through the third thread, so as to send the data result to the source IP port.
Correspondingly, the invention also provides a data transmission device, which comprises: the device comprises a creation module, a storage module, an extraction module and a return module;
the creation module is used for receiving the data packet to be sent and creating threads and queues;
the storage module is used for analyzing the data packet to be sent according to the created thread and storing the analyzed data packet to be sent in the queue; the parsed data packet to be sent comprises: data, a time interval between each piece of data, a source IP port and a target IP port;
the extraction module is used for extracting the data from the queue and sequentially sending the data to the target IP port according to the time interval between each piece of data;
and the return module is used for sending the data result to the source IP port after the target IP port returns the data result.
Preferably, the receiving the data packet to be sent and creating a thread and a queue specifically include:
responding to all data to be transmitted, time intervals between each piece of data, a source IP port and a target IP port set by a user, packaging to generate a data packet to be transmitted, and reading the data packet to be transmitted;
after reading and receiving the data packet to be sent, creating a thread and a queue; wherein the thread comprises: the first thread, the second thread and the third thread, wherein the queues comprise a first queue, a second queue and a third queue.
As a preferred solution, the parsing the data packet to be sent according to the created thread, and storing the parsed data packet to be sent in the queue, which specifically includes:
analyzing the data packet to be sent through the first thread;
storing the source IP port obtained by analysis in the third queue, and storing the data packet to be transmitted after analysis in the first queue;
and waking up the second thread after the parsed data packet to be sent is completely stored in the first queue.
Preferably, the extracting the data from the queue and sequentially sending the data to the target IP port according to a time interval between each piece of data specifically includes:
after the second thread wakes up, detecting that the parsed data packet to be sent exists in the first queue through the second thread, and taking out all data stored in the first queue, so that the data is sent to a target IP port according to the time interval between each piece of data; the parsed data packet to be sent comprises: data, time intervals between each piece of data, and a target IP port.
As a preferred solution, after the target IP port returns a data result, the sending the data result to the source IP port specifically includes:
after receiving a data result returned by the target IP port through the second thread, storing the data result in a second queue, and waking up the third thread;
and after waking up the third thread, extracting a source IP port stored in a third queue and a data result stored in a second queue through the third thread, so as to send the data result to the source IP port.
Correspondingly, the invention also provides a data transmission system, which comprises: the system comprises a web interface end, a CGI process, a finishing forwarding process and a target end;
the web interface end is used for responding to data to be sent, the time interval between each piece of data and the target IP port input by a user, and generating a data packet to be sent according to the source IP port corresponding to the web interface end, so that the data packet to be sent is sent to the CGI process;
the arrangement forwarding process is configured to execute the data transmission method according to any one of the above;
the target end is used for processing the data sent by the arrangement forwarding process, generating a data result and sending the data result back to the arrangement forwarding process;
the CGI process is used for receiving and sending the data packet to be sent to the sorting and forwarding process, receiving a data result sent by the sorting and forwarding process, and forwarding the data result back to the web interface end.
Preferably, the web interface end is further configured to:
responding to the data cycle sending times input by a user, and packaging the data cycle sending times, the data, the time interval between each piece of data, the target IP port and the source IP port to generate a data packet to be sent;
and forwarding to the CGI process according to the data cycle sending times, so as to sequentially and circularly send the data packets to be sent to the finishing forwarding process.
As a preferred scheme, the web interface end is further used for sequentially receiving data results sent from the CGI process and then from the finishing forwarding process; and the CGI process forwards the data result to the web interface end after receiving the data result sent from the finishing forwarding process every time.
As a preferred solution, the forwarding to the CGI process according to the number of data cycle sending, so as to sequentially and circularly send the data packet to be sent to the finishing forwarding process, specifically including:
judging whether the number of the data cycle transmission times is 1;
if yes, forwarding the data packet to be sent to the CGI process directly, and further sending the data packet to be sent once to the sorting forwarding process;
if not, recording and forwarding the data packet to be sent to the CGI process, and further sending the data packet to be sent to the sorting forwarding process as one-time actual forwarding, and ending sending the data packet to be sent when the actual forwarding times are the same as the data cycle sending times.
Compared with the prior art, the embodiment of the invention has the following beneficial effects:
according to the technical scheme, the thread and the queue are constructed by receiving the data packet to be sent, so that the data packet to be sent can be analyzed, the problem that the existing process of forwarding and receiving data is frequently triggered to cause the transmission of a plurality of pieces of data can not be circularly sent is avoided, the data packet to be sent is analyzed through the created thread and the created queue, the analyzed data, the time interval between each piece of data, the source IP port, the target IP port and the like are stored in the queue, the data packet to be sent can be completely sent to the target IP port each time, the resource mutual exclusion caused in the data forwarding or sending process is avoided, the efficiency of data transmission and transmission in the queue is improved, the occurrence of data transmission errors is reduced, the accuracy of data transmission is improved, and after the data result is returned through the target IP port, the data result is directly returned to the source IP port, and the scheme of high-accuracy and high-efficiency data transmission is maintained is further realized.
Drawings
Fig. 1: the embodiment of the invention provides a step flow chart of a data transmission method;
fig. 2: the implementation schematic diagram of the data transmission method is provided for the embodiment of the invention;
fig. 3: the embodiment of the invention provides a structure schematic diagram of a data transmission device;
fig. 4: the embodiment of the invention provides a timing diagram of a data transmission system;
fig. 5: the invention provides a flow chart for data cycle sending and transmission.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Example 1
Referring to fig. 1, a data transmission method provided in an embodiment of the present invention includes steps S101 to S104:
step S101: and receiving the data packet to be sent, and creating threads and queues.
As a preferred solution of this embodiment, the receiving the data packet to be sent and creating a thread and a queue specifically includes:
responding to all data to be transmitted, time intervals between each piece of data, a source IP port and a target IP port set by a user, packaging to generate a data packet to be transmitted, and reading the data packet to be transmitted; after reading and receiving the data packet to be sent, creating a thread and a queue; wherein the thread comprises: the first thread, the second thread and the third thread, wherein the queues comprise a first queue, a second queue and a third queue.
It should be noted that, the source IP port may be an IP port corresponding to a web end of a browser, a terminal control device, or the like, and the target IP port may be an IP port corresponding to a control terminal device, a processing terminal device, a server, or the like, so as to implement an internet of things between a device of the source IP port and a device of the target IP port, and further implement data transmission and communication between two devices of the internet of things.
In this embodiment, after receiving a data packet to be sent, two sockets are directly created to transfer data, where one socket is used to receive the data packet to be sent, and the other socket is used to send data to an IP port returned by a source IP port, so as to create a process and a queue capable of processing, sorting and forwarding the data packet to be sent, and further, fast and clearly forward, store and extract the data packet to be sent and corresponding data and the like, and preferably, referring to fig. 2, the thread includes: a first thread, a second thread, and a third thread; the first thread can be used for analyzing the data packet to be sent and forwarding the data information in the analyzed data packet to be sent; the second thread can be used for extracting and sending the data in the data packet to be sent to the corresponding target IP port to process the data, so that a data result processed by the target IP port is received and forwarded; the third thread may be used to extract the data results and extract the source IP port, and forward the data results to the source IP port.
Further, preferably, the queue includes: a first queue, a second queue, and a third queue; the first queue may be used to store a parsed data transmit queue; the second queue may be used to store a queue that sends return data results; the third queue may be used to store an address queue of the source IP port that sent the return data.
Step S102: analyzing the data packet to be sent according to the created thread, and storing the analyzed data packet to be sent in the queue; the parsed data packet to be sent comprises: data, time intervals between each piece of data, source IP port and destination IP port.
As a preferred solution of this embodiment, the parsing, according to the created thread, the data packet to be sent, and storing the parsed data packet to be sent in the queue, specifically includes:
analyzing the data packet to be sent through the first thread; storing the source IP port obtained by analysis in the third queue, and storing the data packet to be transmitted after analysis in the first queue; and waking up the second thread after the parsed data packet to be sent is completely stored in the first queue.
In this embodiment, after the first thread receives data, the corresponding source IP port for the first thread that receives the data packet to be sent is first stored in the third queue, and is used to return the data result. The first thread analyzes a data packet to be sent, the analyzed data packet comprises data to be sent, interval time between each piece of data and a target IP port of each group of data, the first thread stores the analyzed data into a first queue, and the first thread notifies a second thread to wake up the second thread from a dormant state.
Furthermore, in order to avoid resource mutual exclusion caused by taking storage data from a queue among threads, and simultaneously in order to save system resources, a condition variable is used for locking when the data is taken or stored, unlocking is performed after the data is taken or stored, and other threads sleeping due to unsatisfied data transmission conditions are notified to wake up.
It should be noted that, when the lock is used to store data in the queue, the data in the queue is guaranteed not to be affected by other threads, for example: the first thread puts data into the first queue, and if the first thread does not put data into the queue without a lock, the second thread detects that the data is in the queue, the data is extracted from the queue, and the resource mutual exclusion is caused. Under the condition of locking, the first thread Cheng Zaicun is locked before data, the second thread can not fetch the data under the condition of detecting the lock, and the second thread can fetch the data in the queue only after waiting until the first thread stores the data and then unlocking the data. However, this method may cause waste of system resources, for example, in the case of the second thread, if there is no condition variable, the second thread needs to know whether there is data in the queue, and needs to lock (activate) all the time to extract the data from the second queue, then determine whether the data is empty, if so, unlock (sleep) is required, and then repeat the above operation until the data is not empty, which causes waste of system resources.
Furthermore, the problem of system resource waste can be effectively solved by using the condition variable. The use of the condition variable needs to rely on thread lock, saving system resources is mainly embodied in the aspect of taking data, a second thread extracts data from a first queue, judging whether the data is empty or not, if the data is empty, calling an api interface of the condition variable, enabling the second thread to be in wait state and unlocking at the same time, after the first thread analyzes the data and stores the data in the queue, the first thread calls the interface to wake up the second thread, and the second thread locks the data again and then unlocks to finish the operation. The conditional variable avoids repeated operations such as continuous locking, data acquisition, judgment, unlocking and the like of the thread under the condition that no data exists in the queue, and saves system resources.
Step S103: and extracting the data from the queue, and sequentially sending the data to the target IP port according to the time interval between each piece of data.
As a preferred solution of this embodiment, the extracting the data from the queue and sequentially sending the data to the target IP port according to a time interval between each piece of data specifically includes:
after the second thread wakes up, detecting that the parsed data packet to be sent exists in the first queue through the second thread, and taking out all data stored in the first queue, so that the data is sent to a target IP port according to the time interval between each piece of data; the parsed data packet to be sent comprises: data, time intervals between each piece of data, and a target IP port.
In this embodiment, after the second thread is awakened, all data, the interval time between each piece of data and the target IP port are extracted from the first queue, and after the time interval taken by dormancy, the second thread sends the data in the data packet to be sent to the target IP port through the socket.
Step S104: and after the target IP port returns the data result, the data result is sent to the source IP port.
As a preferred solution of this embodiment, after the target IP port returns a data result, the sending the data result to the source IP port specifically includes:
after receiving a data result returned by the target IP port through the second thread, storing the data result in a second queue, and waking up the third thread; and after waking up the third thread, extracting a source IP port stored in a third queue and a data result stored in a second queue through the third thread, so as to send the data result to the source IP port.
In this embodiment, the second thread waits for the returned data result of the target IP port in the blocking state, and after receiving the returned data result, the second thread puts the data result into the second queue, and the second thread wakes up the third thread, and after the third thread wakes up, returns the data result in the second queue to the corresponding source IP port stored in the third queue.
Further, similar to step S102, after the second thread receives the data result returned by the target IP port, the second thread stores the data result in the second queue, and then uses the condition variable to enable the third thread to extract data from the second queue, determine whether the data is empty, if so, call the api interface of the condition variable, let the third thread be in wait state, and unlock the data at the same time, after the second thread stores the data result in the second queue, the second thread calls the interface to wake up the third thread, lock the third thread Cheng Chongxin to extract the data result, and then unlock the data to complete the operation. Similarly, after the third thread wakes up, the source IP port is extracted by re-locking, and then the source IP port is extracted by unlocking.
The implementation of the above embodiment has the following effects:
according to the technical scheme, the thread and the queue are constructed by receiving the data packet to be sent, so that the data packet to be sent can be analyzed, the problem that the existing process of forwarding and receiving data is frequently triggered to cause the transmission of a plurality of pieces of data can not be circularly sent is avoided, the data packet to be sent is analyzed through the created thread and the created queue, the analyzed data, the time interval between each piece of data, the source IP port, the target IP port and the like are stored in the queue, the data packet to be sent can be completely sent to the target IP port each time, the resource mutual exclusion caused in the data forwarding or sending process is avoided, the efficiency of data transmission and transmission in the queue is improved, the occurrence of data transmission errors is reduced, the accuracy of data transmission is improved, and after the data result is returned through the target IP port, the data result is directly returned to the source IP port, and the scheme of high-accuracy and high-efficiency data transmission is maintained is further realized.
Example two
Referring to fig. 3, a data transmission device provided by the present invention includes: a creation module 201, a deposit module 202, an extraction module 203 and a return module 204.
The creation module 201 is configured to receive a data packet to be sent, and create a thread and a queue;
the storage module 202 is configured to parse the data packet to be sent according to the created thread, and store the parsed data packet to be sent in the queue; the parsed data packet to be sent comprises: data, a time interval between each piece of data, a source IP port and a target IP port;
the extracting module 203 is configured to extract the data from the queue, and sequentially send the data to the target IP port according to a time interval between each piece of data;
the return module 204 is configured to send the data result to the source IP port after the data result is returned by the destination IP port.
As a preferred solution of this embodiment, the receiving the data packet to be sent and creating a thread and a queue specifically includes:
responding to all data to be transmitted, time intervals between each piece of data, a source IP port and a target IP port set by a user, packaging to generate a data packet to be transmitted, and reading the data packet to be transmitted; after reading and receiving the data packet to be sent, creating a thread and a queue; wherein the thread comprises: the first thread, the second thread and the third thread, wherein the queues comprise a first queue, a second queue and a third queue.
As a preferred solution of this embodiment, the parsing, according to the created thread, the data packet to be sent, and storing the parsed data packet to be sent in the queue, specifically includes:
analyzing the data packet to be sent through the first thread; storing the source IP port obtained by analysis in the third queue, and storing the data packet to be transmitted after analysis in the first queue; and waking up the second thread after the parsed data packet to be sent is completely stored in the first queue.
As a preferred solution of this embodiment, the extracting the data from the queue and sequentially sending the data to the target IP port according to a time interval between each piece of data specifically includes:
after the second thread wakes up, detecting that the parsed data packet to be sent exists in the first queue through the second thread, and taking out all data stored in the first queue, so that the data is sent to a target IP port according to the time interval between each piece of data; the parsed data packet to be sent comprises: data, time intervals between each piece of data, and a target IP port.
As a preferred solution of this embodiment, after the target IP port returns a data result, the sending the data result to the source IP port specifically includes:
after receiving a data result returned by the target IP port through the second thread, storing the data result in a second queue, and waking up the third thread; and after waking up the third thread, extracting a source IP port stored in a third queue and a data result stored in a second queue through the third thread, so as to send the data result to the source IP port.
It will be clear to those skilled in the art that, for convenience and brevity of description, reference may be made to the corresponding process in the foregoing method embodiment for the specific working process of the above-described apparatus, which is not described herein again.
The implementation of the embodiment of the invention has the following effects:
according to the technical scheme, the thread and the queue are constructed by receiving the data packet to be sent, so that the data packet to be sent can be analyzed, the problem that the existing process of forwarding and receiving data is frequently triggered to cause the transmission of a plurality of pieces of data can not be circularly sent is avoided, the data packet to be sent is analyzed through the created thread and the created queue, the analyzed data, the time interval between each piece of data, the source IP port, the target IP port and the like are stored in the queue, the data packet to be sent can be completely sent to the target IP port each time, the resource mutual exclusion caused in the data forwarding or sending process is avoided, the efficiency of data transmission and transmission in the queue is improved, the occurrence of data transmission errors is reduced, the accuracy of data transmission is improved, and after the data result is returned through the target IP port, the data result is directly returned to the source IP port, and the scheme of high-accuracy and high-efficiency data transmission is maintained is further realized.
Example III
Referring to fig. 4, a data transmission system according to an embodiment of the invention includes: a web interface end 01, a CGI process 02, a finishing forwarding process 03 and a target end 04.
The sorting and forwarding process 03 is configured to perform the data transmission method according to the first embodiment.
It should be noted that, for convenience and brevity of description, the specific working process of the above-described sorting and forwarding process 03 may refer to the corresponding process in the first embodiment, which is not described herein again.
The web interface end 01 is configured to respond to data to be sent, a time interval between each piece of data and a target IP port input by a user, and generate a data packet to be sent according to a source IP port corresponding to the web interface end 01, so that the data packet to be sent is sent to the CGI process 02.
The target end 04 is configured to process the data sent by the sorting and forwarding process 03, generate a data result, and send the data result back to the sorting and forwarding process 03.
It should be noted that, the web interface end 01 may be a front end device, that is, may be a front end device capable of being set and operated by a user, and the target end 04 may be a control terminal device, a processing terminal device, or a server, or specifically, may be an internet of things terminal device, so that accurate and efficient data transmission between internet of things devices may be achieved by determining a source IP port of the web interface end 01 and a target IP port of the internet of things terminal device.
In this embodiment, referring to fig. 4, by filling data, each data interval time, a source IP port and a target IP port in a web end of a browser, each group of data can be sent to a specific Linux system device at a web interface end 01 through a SHTTPD server deployed on the Linux system device, the Linux system device analyzes a data packet to be sent according to a rule according to the data sent by the front end of the web interface end 01 and forwards each data to a process designated by a target IP submitted by the front end, and the data returned by the process can be converted back to the web interface end 01 through a middle forwarding process for browsing by a user. The embodiment also has the functions of presetting data and commands, commands can be added in a preset command interface, the commands can be stored on a target platform in a file form after being submitted, and the commands are prompted in the data filling interface.
Further, the implementation of the front end of the web interface end 01 can be built through matching a bootstrap framework with HTML, CSS, javaScript, and JavaScript is used for acquiring data input by a front end user, packaging the data and sending the data to a CGI process 02 program of Linux system equipment through SHTTPD. The SHTTPD is a lightweight web server capable of being embedded into a Linux system, can run on different architecture platforms through different cross compilations, and improves the universality of the system. The use of embedded web servers like Lighttpd, boa, etc. can be achieved as well, except that the differences in how the program is applied need to be through different configurations, compilations.
The CGI process 02 is configured to receive and send the data packet to be sent to the finishing forwarding process 03, receive a data result sent by the finishing forwarding process 03, and forward the data result back to the web interface end 01.
It should be noted that the CGI process 02 may allow a front end (web interface end 01) or a client to request data from the web to a program executed on a web server and forward the data.
As a preferred scheme of this embodiment, the web interface end 01 is further configured to respond to the number of data cycle transmission times input by a user, and package the number of data cycle transmission times with data, a time interval between each piece of data, a target IP port, and a source IP port to generate a data packet to be transmitted; the CGI process 02 is further configured to sequentially and circularly send the data packet to be sent to the finishing forwarding process 03 according to the number of data cycle sending times.
Specifically, the web interface end 01 is composed of two tab pages, wherein the first tab page is a tab page for inputting data and an interval between the data, each data is a textarea control, an add button is arranged under the first control, and the add button is used for adding a data input frame and each data interval time and deleting a button of the frame. There is a text entry box for entering IP and port under the text box for data entry, and also an entry box for transmission interval and number of cyclic transmissions between each group of data, below which is a submit button, below which is a data result for presentation returned from IP and port. After a user clicks a submit button, the JavaStript executes the button binding method, packages data in a page, sends a post request to a background CGI process 02, and if the data exists in a text box responsible for circulation, the JavaScript can circulate to the CGI process 02 according to the input times to send a data packet packaged by the data in the page. The preset data interface is similar to the data sending interface, the preset command is only packaged and sent to the background CGI process 02 through a post request, the CGI process 02 stores the command in a file, and the page is displayed on the page when the page is opened next time.
As a preferred solution of this embodiment, the CGI process 02 is further configured to sequentially receive a data result sent by the sorting forwarding process 03, and forward the data result to the web interface terminal 01 every time a data result is received.
It should be noted that, the CGI process 02 sends the returned result to the front end of the web interface end 01 in a splitting manner through the SHTTPD, and the front end receives and displays the returned result to the web front end interface through the JavaScript operation Dom.
As a preferred solution of this embodiment, according to the number of data cycle sending, the sending the data packet to be sent to the finishing forwarding process 03 sequentially and circularly specifically includes:
judging whether the number of the data cycle transmission times is 1; if yes, the data packet to be sent is directly sent to the arrangement forwarding process 03 once; if not, recording and taking the process of sending the data packet to be sent to the sorting forwarding process 03 as one actual forwarding, and ending sending the data packet to be sent when the actual forwarding times are the same as the data cycle sending times.
In this embodiment, referring to fig. 5, after filling data and information thereof in a data packet to be sent at the web interface end 01 by a user, determining whether the filling cycle sending frequency is greater than 1, sending the data packet to be sent according to the frequency cycle when the filling cycle sending frequency is greater than 1, and sending the data packet to be sent once when the filling cycle sending frequency is not greater than 1, and sending the data packet to a target IP port after passing through program data, thereby returning a data result to the web interface end 01.
It should be noted that, the loop sending is completed in JavaScript at the front end of the web interface end 01, and the data may be a command or some data packets. It can be understood that the cyclically sending data packet can be used to test the capability of the target IP port to receive data and process data, and the cyclically sending command can test the capability of the target IP port to parse the command and whether the operation performed by the application layer after receiving the command meets the expected effect, so as to modify the program or find the cause according to the result.
The implementation of the above embodiment has the following effects:
according to the embodiment of the invention, through the web interface end, the CGI process, the arrangement forwarding process and the target end, data transmission between the Internet of things equipment can be realized, meanwhile, a plurality of pieces of data can be transmitted, a self-defined time interval exists between the data, the data can be circularly transmitted, the data can be a data packet or a plurality of bytes of data, further, according to a protocol formulated by a user, the application circulation developed by the user is verified, whether the developed application function is realized or not is realized, the developed function can be debugged, the normal operation of the function is ensured, and the data communication efficiency between the equipment is improved.
The foregoing embodiments have been provided for the purpose of illustrating the general principles of the present invention, and are not to be construed as limiting the scope of the invention. It should be noted that any modifications, equivalent substitutions, improvements, etc. made by those skilled in the art without departing from the spirit and principles of the present invention are intended to be included in the scope of the present invention.

Claims (9)

1. A data transmission method, comprising:
receiving a data packet to be sent, and creating threads and queues; wherein the thread comprises: the system comprises a first thread, a second thread and a third thread, wherein the queues comprise a first queue, a second queue and a third queue;
analyzing the data packet to be sent according to the created thread, and storing the analyzed data packet to be sent in the queue; analyzing the data packet to be sent through the first thread; storing the source IP port obtained by analysis in the third queue, and storing the data packet to be transmitted after analysis in the first queue; after the parsed data packet to be sent is completely stored in the first queue, waking up the second thread; the parsed data packet to be sent comprises: data, a time interval between each piece of data, a source IP port and a target IP port;
extracting the data from the queue, and sequentially sending the data to the target IP port according to the time interval between each piece of data; after the second thread wakes up, detecting that the parsed data packet to be sent exists in the first queue through the second thread, and taking out all data stored in the first queue, so that the data is sent to a target IP port according to the time interval between each piece of data;
after the target IP port returns a data result, the data result is sent to the source IP port; and waking up the third thread, and after waking up the third thread, extracting a source IP port stored in a third queue and a data result stored in a second queue through the third thread, so as to send the data result to the source IP port.
2. The method for transmitting data according to claim 1, wherein said receiving the data packet to be transmitted and creating the thread and the queue specifically comprises:
responding to all data to be transmitted, time intervals between each piece of data, a source IP port and a target IP port set by a user, packaging to generate a data packet to be transmitted, and reading the data packet to be transmitted;
and after reading and receiving the data packet to be sent, creating a thread and a queue.
3. The method for transmitting data according to claim 2, wherein the extracting the data from the queue and sequentially transmitting the data to the target IP port at intervals between each piece of data, specifically comprises:
after the second thread wakes up, detecting that the parsed data packet to be sent exists in the first queue through the second thread, and taking out all data stored in the first queue, so that the data is sent to a target IP port according to the time interval between each piece of data; the parsed data packet to be sent comprises: data, time intervals between each piece of data, and a target IP port.
4. The method for transmitting data according to claim 3, wherein after the target IP port returns the data result, the method for transmitting the data result to the source IP port specifically comprises:
after receiving a data result returned by the target IP port through the second thread, storing the data result in a second queue, and waking up the third thread;
and after waking up the third thread, extracting a source IP port stored in a third queue and a data result stored in a second queue through the third thread, so as to send the data result to the source IP port.
5. A data transmission apparatus, comprising: the device comprises a creation module, a storage module, an extraction module and a return module;
the creation module is used for receiving the data packet to be sent and creating threads and queues; wherein the thread comprises: the system comprises a first thread, a second thread and a third thread, wherein the queues comprise a first queue, a second queue and a third queue;
the storage module is used for analyzing the data packet to be sent according to the created thread and storing the analyzed data packet to be sent in the queue; analyzing the data packet to be sent through the first thread; storing the source IP port obtained by analysis in the third queue, and storing the data packet to be transmitted after analysis in the first queue; after the parsed data packet to be sent is completely stored in the first queue, waking up the second thread; the parsed data packet to be sent comprises: data, a time interval between each piece of data, a source IP port and a target IP port;
the extraction module is used for extracting the data from the queue and sequentially sending the data to the target IP port according to the time interval between each piece of data; after the second thread wakes up, detecting that the parsed data packet to be sent exists in the first queue through the second thread, and taking out all data stored in the first queue, so that the data is sent to a target IP port according to the time interval between each piece of data;
the return module is used for sending the data result to the source IP port after the target IP port returns the data result; and waking up the third thread, and after waking up the third thread, extracting a source IP port stored in a third queue and a data result stored in a second queue through the third thread, so as to send the data result to the source IP port.
6. A data transmission system, comprising: the system comprises a web interface end, a CGI process, a finishing forwarding process and a target end;
the web interface end is used for responding to data to be sent, the time interval between each piece of data and the target IP port input by a user, and generating a data packet to be sent according to the source IP port corresponding to the web interface end, so that the data packet to be sent is sent to the CGI process;
the arrangement forwarding process is configured to perform the data transmission method according to any one of claims 1 to 4;
the target end is used for processing the data sent by the arrangement forwarding process, generating a data result and sending the data result back to the arrangement forwarding process;
the CGI process is used for receiving and sending the data packet to be sent to the sorting and forwarding process, receiving a data result sent by the sorting and forwarding process, and forwarding the data result back to the web interface end.
7. The data transmission system of claim 6, wherein the web interface is further configured to:
responding to the data cycle sending times input by a user, and packaging the data cycle sending times, the data, the time interval between each piece of data, the target IP port and the source IP port to generate a data packet to be sent;
and forwarding to the CGI process according to the data cycle sending times, so as to sequentially and circularly send the data packets to be sent to the finishing forwarding process.
8. The data transmission system of claim 7, wherein the web interface is further configured to sequentially receive data results sent from the CGI process, and further from the consolidated forwarding process; and the CGI process forwards the data result to the web interface end after receiving the data result sent from the finishing forwarding process every time.
9. A data transmission system according to claim 7 or 8, wherein the forwarding to the CGI process according to the number of data cycle transmission times, so as to sequentially and cyclically transmit the data packet to be transmitted to the finishing forwarding process, specifically includes:
judging whether the number of the data cycle transmission times is 1;
if yes, forwarding the data packet to be sent to the CGI process directly, and further sending the data packet to be sent once to the sorting forwarding process;
if not, recording and forwarding the data packet to be sent to the CGI process, and further sending the data packet to be sent to the sorting forwarding process as one-time actual forwarding, and ending sending the data packet to be sent when the actual forwarding times are the same as the data cycle sending times.
CN202310100912.5A 2023-02-08 2023-02-08 Data transmission method, device and system Active CN116192985B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310100912.5A CN116192985B (en) 2023-02-08 2023-02-08 Data transmission method, device and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310100912.5A CN116192985B (en) 2023-02-08 2023-02-08 Data transmission method, device and system

Publications (2)

Publication Number Publication Date
CN116192985A CN116192985A (en) 2023-05-30
CN116192985B true CN116192985B (en) 2023-11-21

Family

ID=86447237

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310100912.5A Active CN116192985B (en) 2023-02-08 2023-02-08 Data transmission method, device and system

Country Status (1)

Country Link
CN (1) CN116192985B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117478680B (en) * 2023-12-26 2024-03-15 国网四川省电力公司信息通信公司 Terminal data stream transmission remote control method and system based on Internet of things management platform

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108390927A (en) * 2018-02-09 2018-08-10 山东乾云启创信息科技股份有限公司 A kind of method and device of the transmitted in both directions file between client computer and virtual machine
CN109787722A (en) * 2019-01-25 2019-05-21 北京数码视讯技术有限公司 Data transmission method, device and server
CN110032115A (en) * 2019-04-25 2019-07-19 上海法诺光电技术有限公司 A kind of Internet of Things network control system and control method using near field connection real-time, interactive
CN110096340A (en) * 2018-01-29 2019-08-06 北京世纪好未来教育科技有限公司 Timed task processing method and processing device
CN110912786A (en) * 2019-12-27 2020-03-24 深圳市星砺达科技有限公司 Gateway pressure testing method and device, computer equipment and storage medium
CN111416821A (en) * 2020-03-20 2020-07-14 杭州物源科技有限公司 Internet of things equipment information acquisition method, system and device
WO2020259017A1 (en) * 2019-06-24 2020-12-30 同方威视科技江苏有限公司 Time sequence data processing method, apparatus and system, and server and readable storage medium
CN112994851A (en) * 2021-01-26 2021-06-18 中国科学院信息工程研究所 Method and device for supporting differentiated negotiable parallel data communication
CN114595083A (en) * 2022-03-15 2022-06-07 中国工商银行股份有限公司 Message processing method and device, computer equipment and storage medium
CN115454644A (en) * 2022-09-26 2022-12-09 上海乐普云智科技股份有限公司 Task thread processing method and device for real-time monitoring data

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017056194A1 (en) * 2015-09-29 2017-04-06 株式会社 東芝 Information device, information communication terminal, and information processing method

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110096340A (en) * 2018-01-29 2019-08-06 北京世纪好未来教育科技有限公司 Timed task processing method and processing device
CN108390927A (en) * 2018-02-09 2018-08-10 山东乾云启创信息科技股份有限公司 A kind of method and device of the transmitted in both directions file between client computer and virtual machine
CN109787722A (en) * 2019-01-25 2019-05-21 北京数码视讯技术有限公司 Data transmission method, device and server
CN110032115A (en) * 2019-04-25 2019-07-19 上海法诺光电技术有限公司 A kind of Internet of Things network control system and control method using near field connection real-time, interactive
WO2020259017A1 (en) * 2019-06-24 2020-12-30 同方威视科技江苏有限公司 Time sequence data processing method, apparatus and system, and server and readable storage medium
CN110912786A (en) * 2019-12-27 2020-03-24 深圳市星砺达科技有限公司 Gateway pressure testing method and device, computer equipment and storage medium
CN111416821A (en) * 2020-03-20 2020-07-14 杭州物源科技有限公司 Internet of things equipment information acquisition method, system and device
CN112994851A (en) * 2021-01-26 2021-06-18 中国科学院信息工程研究所 Method and device for supporting differentiated negotiable parallel data communication
CN114595083A (en) * 2022-03-15 2022-06-07 中国工商银行股份有限公司 Message processing method and device, computer equipment and storage medium
CN115454644A (en) * 2022-09-26 2022-12-09 上海乐普云智科技股份有限公司 Task thread processing method and device for real-time monitoring data

Also Published As

Publication number Publication date
CN116192985A (en) 2023-05-30

Similar Documents

Publication Publication Date Title
CN101080055B (en) A method, system and device for quickly browsing webpage via mobile phone browser
CN111600909A (en) Data processing method, device, protocol conversion equipment and storage medium
CN106886494A (en) A kind of automatic interface testing method and its system
US20150347305A1 (en) Method and apparatus for outputting log information
US8112470B2 (en) Virtual javascript object notation
CN112187558B (en) Data verification method and device and electronic equipment
CN107861713A (en) Data calling method, device and computer-readable recording medium
CN116192985B (en) Data transmission method, device and system
CN110224896B (en) Network performance data acquisition method and device and storage medium
US7353225B2 (en) Mechanism for comparing content in data structures
CN107463657B (en) File operation method and terminal
CN110222119B (en) Data conversion synchronization method, equipment and storage medium for heterogeneous database
CN104063401A (en) Webpage style address merging method and device
CN113536185B (en) Application page loading method, storage medium and related equipment
CN102819553B (en) A kind ofly carry out the mutual method of the page and device
US20200012545A1 (en) Event to serverless function workflow instance mapping mechanism
CN112527293A (en) Method and device for rendering first screen page, computer equipment and storage medium
CN106686037B (en) Page detection method, device, equipment and system
CN104796426B (en) The detection method at webpage back door
CN112306591A (en) Remote debugging method and device based on page
AU2018390863A1 (en) Computer system and method for extracting dynamic content from websites
CN108376090A (en) Operating method, device, terminal and the storage medium of Web page picture
CN113760274B (en) Front-end assembly logic injection method and device
CN102761527B (en) The access method of serving in cluster and system
US20190012221A1 (en) Collaboration system protocol processing

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
CB02 Change of applicant information
CB02 Change of applicant information

Address after: No. 56 Nanli East Road, Shiqi Town, Panyu District, Guangzhou City, Guangdong Province, 510000

Applicant after: Guangdong Baolun Electronics Co.,Ltd.

Address before: No. 19, Chuangyuan Road, Zhongcun Street, Panyu District, Guangzhou City, Guangdong Province, 511495

Applicant before: GUANGZHOU ITC ELECTRONIC TECHNOLOGY Co.,Ltd.

GR01 Patent grant
GR01 Patent grant