CN107508729B - Data transmission test method and data reception test method - Google Patents

Data transmission test method and data reception test method Download PDF

Info

Publication number
CN107508729B
CN107508729B CN201710880675.3A CN201710880675A CN107508729B CN 107508729 B CN107508729 B CN 107508729B CN 201710880675 A CN201710880675 A CN 201710880675A CN 107508729 B CN107508729 B CN 107508729B
Authority
CN
China
Prior art keywords
character
character sequence
sending
received
data
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
CN201710880675.3A
Other languages
Chinese (zh)
Other versions
CN107508729A (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.)
PAX Computer Technology Shenzhen Co Ltd
Original Assignee
PAX Computer Technology Shenzhen 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 PAX Computer Technology Shenzhen Co Ltd filed Critical PAX Computer Technology Shenzhen Co Ltd
Priority to CN201710880675.3A priority Critical patent/CN107508729B/en
Publication of CN107508729A publication Critical patent/CN107508729A/en
Application granted granted Critical
Publication of CN107508729B publication Critical patent/CN107508729B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0823Errors, e.g. transmission errors
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/12Applying verification of the received information
    • H04L63/123Applying verification of the received information received data contents, e.g. message integrity

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Environmental & Geological Engineering (AREA)
  • Maintenance And Management Of Digital Transmission (AREA)

Abstract

The invention is suitable for the technical field of communication, and provides a data sending test method and a data receiving test method, which comprise the following steps: acquiring a character sequence to be transmitted according to the characteristics of a preset character sequence through first transmitting equipment; the first sending equipment is tested equipment; sending the character sequence to a first receiving device, and sending a next character sequence to the first receiving device; receiving the character sequence sent by the first sending device through the first receiving device; the first receiving equipment is trusted test service equipment; verifying the received character sequence according to the characteristics of the preset character sequence; and if the content of the received certain byte is inconsistent with the preset data, suspending receiving the character sequence sent by the first sending device. The invention can directly determine the correctness of the sending channel or the receiving channel by using the sequence with certain characteristics as test data.

Description

Data transmission test method and data reception test method
Technical Field
The invention belongs to the technical field of communication, and particularly relates to a data sending test method and a data receiving test method.
Background
With the development of mobile communication technology and network security technology, when more and more communication modes (such as ethernet communication, serial communication, USB communication, bluetooth communication, wireless WiFi communication, etc.) are used for information transmission, the correctness of the sending channel and the receiving channel needs to be verified, which is the most basic requirement for data transmission. In the process of implementing the present invention, the inventor finds that the existing random number loopback test method has certain defects.
The process of adopting the random number loopback test method comprises the following steps: generating random data at a sending end and sending out, and looping back a response to an original state after an opposite end receives the data; the sending end receives the data again, and compares the received data with the sent data, thereby verifying the correctness of the sending channel or the receiving channel. However, this method requires the simultaneous use of the transmission and reception channels of the device under test, and when a communication problem occurs, it is difficult to determine whether the transmission channel or the reception channel has the problem.
Disclosure of Invention
In view of this, embodiments of the present invention provide a data sending test method and a data receiving test method to solve the problem that it is difficult to determine whether a sending channel or a receiving channel occurs by using a random number loopback test method.
A first aspect of an embodiment of the present invention provides a data transmission testing method, including:
acquiring a character sequence to be transmitted according to the characteristics of a preset character sequence through first transmitting equipment; the first sending equipment is tested equipment;
sending the character sequence to a first receiving device, and sending a next character sequence to the first receiving device;
receiving the character sequence sent by the first sending device through the first receiving device; the first receiving equipment is trusted test service equipment;
verifying the received character sequence according to the characteristics of the preset character sequence;
and if the content of the received certain byte is inconsistent with the preset data, suspending receiving the character sequence sent by the first sending device.
Optionally, the obtaining the character sequence to be sent according to the characteristics of the preset character sequence specifically includes:
allocating a temporary memory for the first sending device, wherein the size of the temporary memory is not less than the maximum character number M of single transmission data; initializing the value S of the current first character to be sent and the character count C1 already sent;
determining the number L of characters to be sent, and acquiring a character sequence to be sent consisting of L characters in an increasing or decreasing mode from the first character S to be sent;
the first character S to be transmitted is updated for obtaining the next sequence of characters.
Optionally, the sending the character sequence to the first receiving device specifically includes:
calling a related function provided by a system, and continuously detecting whether a sending channel has enough sending buffer areas;
when detecting that the sending channel has a sending buffer not less than L bytes, calling a sending function provided by the system, sending the obtained character sequence to be sent consisting of L characters, and accumulating the data length L into a sent character count C1.
Optionally, the receiving the character sequence sent by the first sending device specifically includes:
allocating a temporary memory for the first receiving device, wherein the size of the temporary memory is not less than the maximum character number N of single received data; initializing the value R of the current first character to be received and the character count C2 that has been received;
calling a detection function provided by the system, and continuously checking whether data arrives in a receiving channel;
when detecting that data arrives in a receiving channel, calling a receiving function provided by a system, and receiving a character sequence which is sent by the first sending equipment and consists of L characters;
the received character sequence is stored in a receive buffer and the data length L is accumulated into a received character count C2.
Optionally, the verifying the received character sequence according to the characteristic of the preset character sequence specifically includes:
when the preset character sequence is a circularly increasing sequence, comparing the received character sequence in an increasing mode; when the preset character sequence is a circular decreasing sequence, comparing the received character sequence in a decreasing mode;
the first character R to be received is updated for alignment of the next received character sequence.
A second aspect of the embodiments of the present invention provides a data reception test method, including:
acquiring a character sequence to be transmitted according to the characteristics of a preset character sequence through second transmitting equipment; the second sending equipment is trusted test service equipment;
sending the character sequence to a second receiving device, and sending a next character sequence to the second receiving device;
receiving, by the second receiving device, the character sequence transmitted by the second transmitting device; the second receiving device is a device to be tested;
verifying the received character sequence according to the characteristics of the preset character sequence;
and if the content of the received certain byte is inconsistent with preset data, stopping receiving the character sequence sent by the second sending equipment.
Optionally, the obtaining the character sequence to be sent according to the characteristics of the preset character sequence specifically includes:
allocating a temporary memory for the second sending device, wherein the size of the temporary memory is not less than the maximum character number M' of single transmission data; initializing the value S 'of the current first character to be sent and the character count C1' already sent;
determining the number L ' of characters to be sent, and acquiring a character sequence to be sent consisting of L ' characters in an increasing or decreasing mode from the first character S ' to be sent;
the first character S' to be transmitted is updated for obtaining the next sequence of characters.
Optionally, the sending the character sequence to the second receiving device specifically includes:
calling a related function provided by a system, and continuously detecting whether a sending channel has enough sending buffer areas;
when detecting that the sending channel has a sending buffer not less than L 'bytes, calling a sending function provided by the system, sending the obtained character sequence to be sent consisting of L' characters, and accumulating the data length L 'into a sent character count C1'.
Optionally, the receiving the character sequence sent by the second sending device specifically includes:
allocating a temporary memory for the second receiving device, wherein the size of the temporary memory is not less than the maximum character number N' of the data received at one time; initializing the value R 'of the current first character to be received and the character count C2' that has been received;
calling a detection function provided by the system, and continuously checking whether data arrives in a receiving channel;
when detecting that data arrives in a receiving channel, calling a receiving function provided by a system, and receiving a character sequence which is sent by the second sending equipment and consists of L' characters;
the received character sequence is stored in a receive buffer and the data length L 'is added to the received character count C2'.
Optionally, the verifying the received character sequence according to the characteristic of the preset character sequence specifically includes:
when the preset character sequence is a circularly increasing sequence, comparing the received character sequence in an increasing mode; when the preset character sequence is a circular decreasing sequence, comparing the received character sequence in a decreasing mode;
the first character R' to be received is updated for alignment of the next received character sequence.
Compared with the prior art, the embodiment of the invention has the following beneficial effects: the method and the device adopt a character sequence with certain characteristics as test data, adopt a trusted test service device as a sending device or a receiving device, send the test data by the sending device, receive the sent test data by the receiving device, verify the received character sequence according to the characteristics of the character sequence, and suspend receiving the character sequence sent by the sending device if the content of a certain byte received is inconsistent with the preset data. By adopting a sequence with certain characteristics as test data, whether the received data is correct or not can be verified at the receiving equipment, and the correctness of a sending channel or a receiving channel can be further determined.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
Fig. 1 is a schematic diagram of a data transmission testing method according to an embodiment of the present invention;
FIG. 2 is a diagram illustrating a data reception testing method according to an embodiment of the present invention;
fig. 3 is a flowchart illustrating an implementation flow of a first sending device of a data sending test method according to an embodiment of the present invention;
fig. 4 is a schematic diagram of generating a character sequence to be transmitted in an incremental manner according to an embodiment of the present invention;
fig. 5 is a schematic diagram of generating a character sequence to be transmitted in a descending manner according to an embodiment of the present invention;
fig. 6 is a schematic flow chart of an implementation of a first receiving device of the data transmission testing method according to the embodiment of the present invention.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the invention. It will be apparent, however, to one skilled in the art that the present invention may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present invention with unnecessary detail.
In order to explain the technical means of the present invention, the following description will be given by way of specific examples.
Example one
Referring to fig. 1, a schematic flow chart of an implementation of the data transmission testing method according to the embodiment of the present invention is provided, which is detailed as follows:
step S101, acquiring a character sequence to be transmitted according to the characteristics of a preset character sequence through first transmitting equipment; the first sending device is a device under test.
In order to test the correctness of the data transmission channel, the transmission device needs to be set as a device to be tested. The acquired character sequence is a regular set of character sequences generated by the first transmitting device.
In the prior art, a random number is usually used to verify the correctness of the transmitting channel or the receiving channel, however, this method needs to use the transmitting channel and the receiving channel of the device to be tested simultaneously to verify whether the received data is consistent with the transmitted data. However, when data transmission is erroneous, it is difficult to determine whether a problem occurs in the transmission channel or the reception channel because the transmission channel and the reception channel to the device to be tested are used at the same time. In the embodiment, a character sequence with a certain rule is used, so that the received data only needs to be verified at the receiving end, and when the data transmission is wrong, the problem of the sending channel can be directly determined.
Further, the process of obtaining the character sequence to be transmitted according to the characteristics of the preset character sequence by the first transmitting device is as follows:
allocating a temporary memory for the first sending device, wherein the size of the temporary memory is not less than the maximum character number M of single transmission data; the value S of the current first character to be sent and the character count C1 that has been sent are initialized.
Determining the number L of characters to be sent, and acquiring a character sequence to be sent consisting of L characters in an increasing or decreasing mode from the first character S to be sent.
The first character S to be transmitted is updated for obtaining the next sequence of characters.
It will be readily appreciated that in order to meet the maximum number of characters transmitted in a single transmission throughout the test, the first transmitting device needs to be allocated sufficient memory M. For example, if the maximum number of characters to be tested in a single transmission is 10240 bytes, then 10240 bytes of data memory can be allocated to meet the requirement. Before sending data, the communication port needs to be opened and configured, so that the sending operation can be normally operated. Here we open and configure the communication port by calling the API function provided by the system. In order to count the erroneous byte bits, the expected correct value and the total number of received characters, the first character to be sent and the character count to be sent need to be cleared when the communication is erroneous.
In order to count the number of received characters, the number L of characters to be sent needs to be determined first, where the number of characters may be a random number within a certain range, may also be a preset fixed length value, or may also be a progressively changing length value. For example, each character to be transmitted may be a fixed value with a length of 1 or 5, or may be a sequence of characters with data lengths of 3, 5, 7, 9, etc. that are sequentially increased.
After the number of characters to be sent is determined, a character sequence is generated from the first character S to be sent in a preset character generation mode, and the generated character sequence is distributed to a memory of the first device. For example, when the predetermined data sample is a circular increasing sequence, the data is generated in an increasing manner, and when the predetermined data sample is a circular decreasing sequence, the data is generated in a decreasing manner. Where the form of incremental or decremental generation of data samples needs to be preset prior to testing.
After a segment of character sequence is sent out, the value of the first character to be sent needs to be updated to obtain the next segment of character sequence. Specifically, when the character sequence is generated in a cyclic increment manner, the updated first character value needs to be 1 more than the value of the last byte of the data to be transmitted this time, and when the value of the last byte is 255, the updated first character value is 0. Similarly, when the character sequence is generated in a circular decreasing manner, the updated first character value needs to be 1 less than the value of the last byte of the data transmitted this time, and when the value of the last byte is 0, the updated first character value is 255.
Step S102, the character sequence is sent to the first receiving device, and the next character sequence is sent to the first receiving device.
Further, the process of sending the character sequence to the first receiving device is as follows:
and calling a correlation function provided by the system to continuously detect whether the transmission channel has enough transmission buffers.
When detecting that the sending channel has a sending buffer not less than L bytes, calling a sending function provided by the system, sending the obtained character sequence to be sent consisting of L characters, and accumulating the data length L into a sent character count C1.
It is easy to understand that before sending the data to be tested, it needs to detect whether the sending channel has enough sending buffer area, and the data to be sent can be sent out only when there is enough buffer area. Here, the sufficient transmission buffer refers to the length L of data to be transmitted at a single time.
Step S103, receiving the character sequence sent by the first sending device through the first receiving device; the first receiving device is a trusted test service device.
In order to test the correctness of the sending channel, a receiving device is required to be arranged to receive and verify the data sent by the sending device, wherein the receiving device is a trusted test service device.
Further, the process of receiving the character sequence sent by the first sending device is as follows:
allocating a temporary memory for the first receiving device, wherein the size of the temporary memory is not less than the maximum character number N of single received data; the value R of the current first character to be received and the character count C2 that has been received are initialized.
And calling a detection function provided by the system to continuously check whether the receiving channel has the arrival of data.
And when detecting that data arrives in the receiving channel, calling a related receiving function provided by the system, and receiving a character sequence consisting of L characters sent by the first sending device.
The received character sequence is stored in a receive buffer and the data length L is accumulated into a received character count C2.
It will be readily appreciated that in order to meet the maximum number of characters transmitted per receive throughout the test, the first receiving device needs to be allocated sufficient memory N. The selection of the maximum memory needs to ensure that the data receiving end does not overflow the received data. The communication port also needs to be opened and configured before receiving data. In order to count the byte bits and the total number of received characters when communication errors occur, the value R of the current initial character to be received and the count C2 of the received characters need to be cleared.
Before receiving the character sequence, checking whether the receiving channel has data coming, wherein, the detecting function provided by the system is called to detect whether the receiving channel has data coming. And in the case of detecting the arrival of the data, calling a receiving function provided by the system to receive the L character sequences sent by the sending equipment. Meanwhile, in order to count the number of received characters, the character length of each reception needs to be added to the received character count C2.
And step S104, verifying the received character sequence according to the characteristics of the preset character sequence.
Further, the process of verifying the received character sequence according to the characteristics of the preset character sequence is as follows:
when the preset character sequence is a circularly increasing sequence, comparing the received character sequence in an increasing mode; and when the preset character sequence is a circular decreasing sequence, comparing the received character sequence in a decreasing mode.
The first character R to be received is updated for alignment of the next received character sequence.
Specifically, in the process of verifying received data, the received character sequences need to be aligned byte by byte. The comparison is performed according to the characteristics of the preset character sequence, when the comparison of a segment of the character sequence is completed, the first character to be received needs to be updated, specifically, when the character sequence is generated in a cyclic increment manner, the value of the updated first character needs to be 1 more than the value of the last byte of the data to be transmitted at this time, and when the value of the last byte is 255, the value of the updated first character is 0. Similarly, when the character sequence is generated in a circular decreasing manner, the updated first character value needs to be 1 less than the value of the last byte of the data transmitted this time, and when the value of the last byte is 0, the updated first character value is 255.
Step S105, if the content of the received certain byte is inconsistent with the preset data, suspending receiving the character sequence sent by the first sending device, and reporting that the first sending device has an error.
When the expected character value is inconsistent with the actual character value in the comparison process, the number 1 is returned to indicate that the comparison is not passed. When the comparison is wrong, the receiving of the transmitted character sequence is suspended, and the error is reported. Meanwhile, the contents of reporting the error include: the value of the received error data byte, the expected correct value, and the location of the error data byte, further comprising: the total number of characters received so far, the content of all data currently received, etc.
The data transmission test method adopts a circularly increasing or decreasing character sequence as test data, adopts a trusted test service device as a receiving device, and adopts the transmitting device to continuously transmit the test data, and the receiving device receives the transmitted test data, verifies the received character sequence according to the characteristics of the character sequence, and suspends the reception of the character sequence transmitted by the transmitting device and reports the error of the transmitting device if the content of a certain byte received is inconsistent with the preset data. By adopting the circularly increasing or decreasing character sequence as the test data, the receiving device can verify whether the received data is correct or not so as to determine the correctness of the transmitting channel.
Example two
Corresponding to the implementation process of the data transmission test method, the present embodiment provides a data reception test method. Referring to fig. 2, a schematic flow chart of an implementation of the data reception testing method according to the embodiment of the present invention is described in detail as follows:
step S201, acquiring a character sequence to be transmitted according to the characteristics of a preset character sequence through second transmitting equipment; the second sending device is a trusted test service device.
Further, acquiring a character sequence to be transmitted according to a characteristic of a preset character sequence specifically includes:
and allocating a temporary memory for the second sending device, wherein the size of the temporary memory is not less than the maximum character number M ' of single-time transmission data, and initializing the value S ' of the current first character to be sent and the character count C1 ' which is sent.
Determining the number L ' of characters to be sent, and acquiring a character sequence to be sent consisting of L ' characters in an increasing or decreasing mode from the first character S ' to be sent.
The first character S' to be transmitted is updated for obtaining the next sequence of characters.
Step S202, the character sequence is sent to the second receiving device, and the next character sequence is sent to the second receiving device.
Further, the sending the character sequence to the second receiving device specifically includes:
and calling a correlation function provided by the system to continuously detect whether the transmission channel has enough transmission buffers.
When detecting that the sending channel has a sending buffer not less than L 'bytes, calling a sending function provided by the system, sending the obtained character sequence to be sent consisting of L' characters, and accumulating the data length L 'into a sent character count C1'.
Step S203, receiving the character sequence sent by the second sending device through the second receiving device; the second receiving device is a device under test.
Further, the receiving the character sequence sent by the second sending device specifically includes:
allocating a temporary memory for the second receiving device, wherein the size of the temporary memory is not less than the maximum character number N' of the data received at one time; the value R 'of the current first character to be received and the character count C2' that has been received are initialized.
And calling a detection function provided by the system to continuously check whether the receiving channel has the arrival of data.
And when detecting that data arrives in the receiving channel, calling a receiving function provided by the system, and receiving the character sequence consisting of the L' characters sent by the second sending equipment.
The received character sequence is stored in a receive buffer and the data length L 'is added to the received character count C2'.
And step S204, verifying the received character sequence according to the characteristics of the preset character sequence.
Further, the verifying the received character sequence according to the characteristics of the preset character sequence specifically includes:
when the preset character sequence is a circularly increasing sequence, comparing the received character sequence in an increasing mode; and when the preset character sequence is a circular decreasing sequence, comparing the received character sequence in a decreasing mode.
The first character R' to be received is updated for alignment of the next received character sequence.
Step S205, if the content of the received certain byte is inconsistent with the preset data, suspending receiving the character sequence sent by the second sending device.
The data receiving test process and the data sending test process are basically consistent, only in the data receiving test process, the sending equipment is the trusted test equipment, and in the data sending test process, the receiving equipment is the trusted test equipment. Therefore, the detailed working process in the data receiving test is not described herein.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
The data receiving test method adopts a circularly increasing or decreasing character sequence as test data, adopts a trusted test service device as a sending device, the sending device continuously sends the test data, the receiving device receives the sent test data and verifies the received character sequence according to the characteristics of the character sequence, and if the content of a certain received byte is inconsistent with the preset data, the character sequence sent by the sending device is suspended to be received, and the sending device is reported to make an error. By adopting the circularly increasing or decreasing character sequence as the test data, the receiving device can verify whether the received data is correct or not so as to determine the correctness of the receiving channel.
EXAMPLE III
Fig. 3 shows a schematic flow chart of a first sending device of the data sending test method. The method of testing at a first transmitting device comprises the steps of:
step S301: and allocating a sending buffer with the capacity of M bytes for the first sending device.
Step S302: and calling related API functions provided by the system, and opening and configuring the communication port.
Step S303: the value S of the first character to be transmitted and the currently transmitted character count C1 are cleared.
Step S304: and determining the number L of the characters to be sent currently.
Step S305: and generating data to be transmitted in an increasing or decreasing mode from the value S of the first character to be transmitted, and storing the data to be transmitted into a transmission cache.
Step S306: the value S of the first character to be sent is updated.
Step S307: judging whether the idle sending buffer is more than or equal to the number L of the characters sent currently, and executing the step S308 when the idle sending buffer is more than the number L of the characters sent currently; otherwise, step S307 is executed until the idle transmission buffer is greater than or equal to the number L of characters currently transmitted.
Step S308: the data stored in the transmission buffer is transmitted, and the transmitted character count C1 is updated so that C1 becomes C1+ L.
Step S309: judging whether the test task is completed or whether the first sending equipment receives a test termination command, and executing the step S310 after the test task is completed or the test termination command is received; otherwise, step S306 is executed.
Step S310: and closing the communication port and stopping the test process.
Step S311: the test procedure of the first transmitting device is ended.
The process of generating data to be transmitted in an increasing or decreasing manner mentioned in step S305 is as follows. Specifically, referring to fig. 4, a schematic diagram of generating a character sequence to be transmitted in an incremental manner according to an embodiment of the present invention is provided. The process of generating data to be transmitted in an incremental manner is as follows:
step S401: i is initialized to 0 and S is set to the current first character value to be sent.
Step S402: judging whether i is smaller than the designated length L, and executing the step S403 when i is smaller than the designated length L; when i is equal to the specified length, step S405 is performed.
Step S403: when i is smaller than the specified length, the ith byte of the data to be transmitted this time may be represented as tx _ pool [ i ] ═ S + i) &0 xff.
Step S404: the value of i is incremented by 1 to point to the next byte of data to be sent.
Step S405: the process of generating the incremental character sequence is ended.
Similarly, referring to fig. 5, a schematic diagram of generating a character sequence to be transmitted in a decreasing manner according to an embodiment of the present invention is provided. The process of generating data to be transmitted in a decreasing manner is as follows:
step S501: i is initialized to 0 and S is set to the current first character value to be sent.
Step S502: judging whether i is smaller than the designated length L, and executing the step S503 when i is smaller than the designated length L; when i is equal to the specified length, step S505 is performed.
Step S503: when i is smaller than the specified length, the ith byte of the data to be transmitted this time may be represented as tx _ pool [ i ] ═ S-i) &0 xff.
Step S504: the value of i is incremented by 1 to point to the next byte of data to be sent.
Step S505: the process of generating the descending character sequence is ended.
It is easy to understand that there is one receiving device corresponding to the sending device, and fig. 6 shows a schematic implementation flow diagram of the first receiving device of the data transmission testing method. The test method at the first receiving device comprises the following steps:
step S601: and allocating a receiving buffer with the capacity of N bytes to the first receiving device.
Step S602: and calling related API functions provided by the system, and opening and configuring the communication port.
Step S603: the value R of the first character to be received and the currently received character count C2 are cleared.
Step S604: calling a detection function provided by the system, detecting whether data arrives in the receiving channel, and executing the step S605 when detecting that the data arrives in the receiving channel; otherwise, step S604 is executed until the receiving channel is detected to have data coming.
Step S605: the data is received from the receiving channel, stored in the receiving buffer, and the count of the received characters C2 is updated, so that C2 is C2+ the length of the data received this time.
Step S606: starting from the value R of the first character to be received, the received data are aligned in an increasing or decreasing manner.
Step S607: when the comparison is passed, that is, the content of a certain byte of the received character sequence is consistent with the content of the expected byte, step S608 is executed; when the alignment fails, that is, the content of a certain byte of the received character sequence is not consistent with the content of the expected byte, step S610 is executed.
Step S608: and updating the value R of the initial character to be received for comparing the data when the data is received next time.
Step S609: judging whether the test task is completed or whether the first receiving device receives a termination test command, and executing the step S611 after the test task is completed or the termination test command is received; otherwise, step S604 is executed.
Step S610: an error condition is reported.
Step S611: and closing the communication port and stopping the test process.
Step S612: the test procedure of the first receiving device is ended.
The implementation process of the second sending device in the data receiving test method is basically the same as the implementation process of the first sending device in the data sending test method, and the implementation process of the second receiving device is basically the same as the implementation process of the first receiving device in the data sending test method. The difference lies in that the devices to be tested are different, the device to be tested is the first sending device in the data sending test method, and the device to be tested is the second receiving device in the data receiving test method, so the test process of the second sending device and the second receiving device is not described again here.
Compared with the prior art, the embodiment of the invention has the following beneficial effects: the embodiment of the invention adopts a circularly increasing or decreasing character sequence as test data, adopts a trusted test service device as a sending device or a receiving device, the sending device continuously sends the test data, the receiving device receives the sent test data and verifies the received character sequence according to the characteristics of the character sequence, and if the content of a certain byte received is inconsistent with the preset data, the character sequence sent by the sending device is suspended to be received, and the sending device is reported to have errors. By adopting the circularly increasing or decreasing character sequence as the test data, the receiving device can verify whether the received data is correct or not so as to determine the correctness of the transmitting channel or the receiving channel.
Those of ordinary skill in the art will appreciate that the various illustrative algorithmic steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or as a combination of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present invention, and are intended to be included within the scope of the present invention.

Claims (8)

1. A method for testing a data transmission channel, the method comprising:
acquiring a character sequence to be transmitted according to the characteristics of a preset character sequence through first transmitting equipment; the first sending equipment is tested equipment; wherein the character sequence is a regular set of character sequences generated by the first transmitting device;
sending the character sequence to a first receiving device, and sending a next character sequence to the first receiving device;
receiving the character sequence sent by the first sending device through the first receiving device; the first receiving equipment is trusted test service equipment;
verifying the received character sequence according to the characteristics of the preset character sequence;
if the content of a certain received byte is inconsistent with preset data, suspending receiving the character sequence sent by the first sending equipment;
the verifying the received character sequence according to the characteristics of the preset character sequence specifically includes:
when the preset character sequence is a circularly increasing sequence, comparing the received character sequence in an increasing mode; when the preset character sequence is a circular decreasing sequence, comparing the received character sequence in a decreasing mode;
the acquiring a character sequence to be transmitted according to the characteristics of a preset character sequence specifically includes:
allocating a temporary memory for the first sending device, wherein the size of the temporary memory is not less than the maximum character number M of single transmission data; initializing the value S of the current first character to be sent and the character count C1 already sent;
determining the number L of characters to be sent, and acquiring a character sequence to be sent consisting of L characters in an increasing or decreasing mode from the first character S to be sent;
the first character S to be transmitted is updated for obtaining the next sequence of characters.
2. The method for testing a data transmission channel according to claim 1, wherein the transmitting the character sequence to the first receiving device specifically includes:
calling a related function provided by a system, and continuously detecting whether a sending channel has enough sending buffer areas;
when detecting that the sending channel has a sending buffer not less than L bytes, calling a sending function provided by the system, sending the obtained character sequence to be sent consisting of L characters, and accumulating the data length L into a sent character count C1.
3. The method for testing a data transmission channel according to claim 1, wherein the receiving the character sequence transmitted by the first transmission device specifically includes:
allocating a temporary memory for the first receiving device, wherein the size of the temporary memory is not less than the maximum character number N of single received data; initializing the value R of the current first character to be received and the character count C2 that has been received;
calling a detection function provided by the system, and continuously checking whether data arrives in a receiving channel;
when detecting that data arrives in a receiving channel, calling a receiving function provided by a system, and receiving a character sequence which is sent by the first sending equipment and consists of L characters;
the received character sequence is stored in a receive buffer and the data length L is accumulated into a received character count C2.
4. The data transmission channel test method according to claim 3, wherein the verifying the received character sequence according to the characteristics of the preset character sequence further comprises:
the first character R to be received is updated for alignment of the next received character sequence.
5. A method for testing a data reception channel, the method comprising:
acquiring a character sequence to be transmitted according to the characteristics of a preset character sequence through second transmitting equipment; the second sending equipment is trusted test service equipment; wherein the character sequence is a regular set of character sequences generated by a second transmitting device;
sending the character sequence to a second receiving device, and sending a next character sequence to the second receiving device;
receiving, by the second receiving device, the character sequence transmitted by the second transmitting device; the second receiving device is a device to be tested;
verifying the received character sequence according to the characteristics of the preset character sequence;
if the content of the received certain byte is inconsistent with preset data, suspending receiving the character sequence sent by the second sending equipment;
the verifying the received character sequence according to the characteristics of the preset character sequence specifically includes:
when the preset character sequence is a circularly increasing sequence, comparing the received character sequence in an increasing mode; when the preset character sequence is a circular decreasing sequence, comparing the received character sequence in a decreasing mode;
the acquiring a character sequence to be transmitted according to the characteristics of a preset character sequence specifically includes:
allocating a temporary memory for the second sending device, wherein the size of the temporary memory is not less than the maximum character number M' of single transmission data; initializing the value S 'of the current first character to be sent and the character count C1' already sent;
determining the number L ' of characters to be sent, and acquiring a character sequence to be sent consisting of L ' characters in an increasing or decreasing mode from the first character S ' to be sent;
the first character S' to be transmitted is updated for obtaining the next sequence of characters.
6. The method for testing a data receiving channel according to claim 5, wherein the sending the character sequence to the second receiving device specifically comprises:
calling a related function provided by a system, and continuously detecting whether a sending channel has enough sending buffer areas;
when detecting that the sending channel has a sending buffer not less than L 'bytes, calling a sending function provided by the system, sending the obtained character sequence to be sent consisting of L' characters, and accumulating the data length L 'into a sent character count C1'.
7. The method for testing a data receiving channel according to claim 5, wherein the receiving the character sequence transmitted by the second transmitting device specifically includes:
allocating a temporary memory for the second receiving device, wherein the size of the temporary memory is not less than the maximum character number N' of the data received at one time; initializing the value R 'of the current first character to be received and the character count C2' that has been received;
calling a detection function provided by the system, and continuously checking whether data arrives in a receiving channel;
when detecting that data arrives in a receiving channel, calling a receiving function provided by a system, and receiving a character sequence which is sent by the second sending equipment and consists of L' characters;
the received character sequence is stored in a receive buffer and the data length L 'is added to the received character count C2'.
8. The data receiving channel testing method of claim 7, wherein the verifying the received character sequence according to the characteristics of the preset character sequence further comprises:
the first character R' to be received is updated for alignment of the next received character sequence.
CN201710880675.3A 2017-09-26 2017-09-26 Data transmission test method and data reception test method Active CN107508729B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710880675.3A CN107508729B (en) 2017-09-26 2017-09-26 Data transmission test method and data reception test method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710880675.3A CN107508729B (en) 2017-09-26 2017-09-26 Data transmission test method and data reception test method

Publications (2)

Publication Number Publication Date
CN107508729A CN107508729A (en) 2017-12-22
CN107508729B true CN107508729B (en) 2020-06-02

Family

ID=60699531

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710880675.3A Active CN107508729B (en) 2017-09-26 2017-09-26 Data transmission test method and data reception test method

Country Status (1)

Country Link
CN (1) CN107508729B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111786831B (en) * 2020-06-30 2021-12-24 赛韵网络科技(上海)有限公司 Communication system and method for optimizing communication session in real time

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101286997A (en) * 2008-06-05 2008-10-15 北京中星微电子有限公司 Data reliability verifying method, system, transmitting device and receiving device
CN104883359A (en) * 2015-05-05 2015-09-02 西安交通大学 Physical layer safety information transmission method based on coherent coding and ARQ combined coding
CN105450613A (en) * 2014-09-01 2016-03-30 展讯通信(上海)有限公司 Data identification system and method

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104734900B (en) * 2013-12-21 2019-05-17 北京市腾河智慧能源科技有限公司 A kind of sending control method of communication protocol test

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101286997A (en) * 2008-06-05 2008-10-15 北京中星微电子有限公司 Data reliability verifying method, system, transmitting device and receiving device
CN105450613A (en) * 2014-09-01 2016-03-30 展讯通信(上海)有限公司 Data identification system and method
CN104883359A (en) * 2015-05-05 2015-09-02 西安交通大学 Physical layer safety information transmission method based on coherent coding and ARQ combined coding

Also Published As

Publication number Publication date
CN107508729A (en) 2017-12-22

Similar Documents

Publication Publication Date Title
KR101370553B1 (en) System, Mobile Communication Unit and Method for Testing a Receiver Performance
KR100772134B1 (en) Error handling in a wireless communications system
US20120051224A1 (en) Method for Testing Wireless Devices Using Predefined Test Segments Initiated by Over-The-Air Signal Characteristics
CN107104782B (en) Data transmission method and device
JP5952808B2 (en) System and method for using multiple network addresses to establish synchronization between a device under test and a test equipment that controls the test
US7324913B2 (en) Methods and apparatus for testing a link between chips
CN102904772A (en) Method and device for realizing throughput test of network equipment
CN101119237A (en) Network card testing method
US10602401B2 (en) Apparatus and method aggregation at one or more layers
CN107508729B (en) Data transmission test method and data reception test method
US20110250847A1 (en) Method for testing appliances for a mobile-radio system, signal generator, appliance for a mobile-radio system, and a measurement system
CN104699580A (en) Loopback test method and device for SAS storage board card
WO2015073400A1 (en) System and method for data packet transceiver testing after signal calibration and power settling to minimize test time
JP2018526848A (en) Method for testing packet error rate of radio frequency (RF) data packet signal transceiver
CN106464449B (en) A kind of information transferring method and equipment
CN116436540A (en) LED display screen receiving card testing method and device, testing card and storage medium
CN109828910A (en) Method and device, the computer equipment, storage medium of monkey test
CN105493594B (en) Transmission method, system, base station and the terminal of Downlink Control Information
CN108289043B (en) Data consistency detection method and device
CN112013506A (en) Communication detection method and device and air conditioner
US11356875B2 (en) Test system and testing method
KR100694204B1 (en) Device and method for testing loopback in WAN system
CN114337873B (en) Communication method, device and system and storage medium
US20200120524A1 (en) Method for Controlling Block Error Rate (BLER) Testing of a Cellular Communication Device for a System Having a Fixed Number of BLER Data Packets
JP5210813B2 (en) Line test system and line test method

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