Python-based communication protocol integration test method, device and medium

By using a Python-based communication protocol integration testing method and building a graphical user interface with the Tkinter library, supporting multiple communication protocols, this approach solves the problems of complexity and high cost of existing testing methods, enables rapid verification of the correctness and reliability of communication protocols, and simplifies the testing process.

CN119544573BActive Publication Date: 2026-03-24INSPUR QILU SOFTWARE IND
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-03
Publication Date
2026-03-24

AI Technical Summary

Technical Problem

Existing communication protocol testing methods are complex, costly, and inflexible, making it difficult to quickly verify the correctness and reliability of communication protocols. Furthermore, multiple tools are required for testing various protocols, increasing the complexity and cost of testing.

Method used

An integration testing method based on Python communication protocols is adopted. A graphical user interface is built using the Tkinter library. By importing various communication modules, multiple communication protocols are supported, including Modbus TCP. This enables the configuration and data interaction between the client and server, ensuring that data is transmitted correctly according to the protocol.

Benefits of technology

It simplifies the testing process, shortens the testing cycle, improves the flexibility and convenience of testing, reduces manpower and time costs, and ensures the correctness and reliability of the communication protocol.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119544573B_ABST
    Figure CN119544573B_ABST
Patent Text Reader

Abstract

The application discloses a communication protocol integration test method and device based on python, and a medium, and belongs to the technical field of Internet of Things data communication, and aims to solve the technical problem of how to conveniently and quickly verify the correctness and reliability of a communication protocol, so as to achieve the purposes of simplifying a test process and shortening a test period, and adopts the technical scheme that the method is to build a graphical user interface by using a Tkinter library, and supports multiple communication protocols by importing multiple communication modules; the communication module is used for processing the bottom-layer interaction with different communication protocols, and ensures that data can be correctly transmitted according to the intended protocol.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of Internet of Things (IoT) data communication technology, specifically a communication protocol integration testing method, device, and medium based on Python. Background Technology

[0002] In today's industrial and commercial environments, the application of Internet of Things (IoT) systems is becoming increasingly widespread, playing a vital role in automation, monitoring, data acquisition, and intelligent decision-making. The core of an IoT system lies in the interconnectivity between its components, which relies on stable and reliable communication protocols.

[0003] In IoT systems, communication protocols between components are crucial for ensuring accurate and timely data transmission. Communication protocols define the data transmission format, rate, error detection, and correction methods. Due to the diversity and complexity of IoT systems, multiple communication protocols exist. Existing communication protocol testing methods typically rely on specific software or hardware tools, which often only support a limited number of protocols. This necessitates the use of multiple different testing tools when testing various communication protocols, increasing testing complexity and cost. Traditional communication protocol testing suffers from numerous and complex protocols, high workload, high cost, and difficulty in guaranteeing data reliability. Furthermore, existing testing methods may lack flexibility and struggle to adapt to constantly changing testing requirements.

[0004] With the development of industrial intelligence and digital transformation, the demand for integration testing of communication protocols is increasing. Therefore, how to conveniently and quickly verify the correctness and reliability of communication protocols, thereby simplifying the testing process and shortening the testing cycle, is a technical problem that urgently needs to be solved. Summary of the Invention

[0005] The technical objective of this invention is to provide a Python-based communication protocol integration testing method, device, and medium to address the problem of how to conveniently and quickly verify the correctness and reliability of communication protocols, thereby simplifying the testing process and shortening the testing cycle.

[0006] The technical objective of this invention is achieved as follows: a Python-based communication protocol integration testing method. This method uses the Tkinter library to build a graphical user interface (GUI) and imports various communication modules to support multiple communication protocols. The communication modules (such as Modbus) handle the low-level interaction with different communication protocols, ensuring that data can be transmitted correctly according to the established protocols. Specifically:

[0007] S1. Select the protocol and client or server type via the graphical user interface column;

[0008] S2. Determine whether it is a client or server type:

[0009] ① If it is a client type, then execute steps S3 to S5;

[0010] ②If it is the server side, then execute steps S6 to S8;

[0011] S3. Complete the configuration of the server communication address, the parameters required for the communication protocol, the address and value of the data to be sent, and the log record of the data transmission;

[0012] S4, Send data;

[0013] S5. Determine whether to terminate the client operation:

[0014] ① If the process ends, proceed to step S9;

[0015] ②If the process has not ended, proceed to step S4;

[0016] S6. Complete the configuration of the client communication address, the parameters required for the communication protocol, the address of the received data, and the log recording of the data reception;

[0017] S7, Receive data;

[0018] S8. Determine whether to terminate server operation:

[0019] ① If the process ends, proceed to step S9;

[0020] ②If the process has not ended, proceed to step S7;

[0021] S9, End.

[0022] As a preferred option, the specific protocol selection is as follows:

[0023] The user interface lists all supported communication protocol names.

[0024] Select the desired communication protocol from the list;

[0025] Choose either client or server;

[0026] Open the corresponding protocol client or server interface.

[0027] As a preferred option, the client acts as both the data generator and sender, as follows:

[0028] Enter the server's IP address and port number in the configuration interface, and a connection with the server will be established based on the information entered.

[0029] After completing the server-side communication address, configure the parameters required for the communication protocol; these parameters include the station number and function code.

[0030] Obtain the template to get a data writing format example under the corresponding protocol, and modify the storage address, the data value type and value size to be sent;

[0031] Save the modified configuration locally as an ini file;

[0032] The client begins sending data, formatting it according to the selected communication protocol;

[0033] The data transmission log records detailed information about each data transmission; this information includes the transmission time and the data content.

[0034] More ideally, the server acts as the data receiver, specifically as follows:

[0035] Enter the client's IP address and port number in the configuration interface, and a connection with the client will be established based on the information entered;

[0036] After completing the client communication address, configure the parameters required for the communication protocol; these parameters include station number and function code.

[0037] Obtain the template to get an example of the data writing format under this protocol, and modify the reading address, the data value type to be read, and the value size;

[0038] Save the modified configuration locally as an ini file;

[0039] The server begins receiving data and formats the received data according to the selected communication protocol;

[0040] The data reception log records detailed information about each data reception, including the time and data content.

[0041] A Python-based communication protocol integration testing system, comprising:

[0042] The interface building module is used to build graphical user interfaces (GUIs) using the Tkinter library;

[0043] The communication module is used to handle the underlying interaction with different communication protocols, ensuring that data can be transmitted correctly according to the established protocol.

[0044] The protocol selection module is used to display various communication protocol names in a list on a graphical user interface, providing an entry point to open the communication protocol client or server;

[0045] The client, as the data generator and sender, is used for configuring the server's communication address, configuring the parameters required for the communication protocol, configuring the address and value of the data to be sent, and logging the data transmission.

[0046] The server, acting as the data receiver, is used for configuring the client's communication address, configuring the parameters required for the communication protocol, configuring the address of the received data, and logging the data reception.

[0047] Preferably, the protocol selection module includes:

[0048] List submodules to list all supported communication protocol names through a user interface list;

[0049] The communication protocol selection submodule is used to select the desired communication protocol from the list;

[0050] The port selection submodule is used to select either the client or the server.

[0051] Open submodules are used to open the operation interface of the corresponding protocol client or server.

[0052] Preferably, the client includes:

[0053] The server-side input submodule is used to input the server's IP address and port number in the configuration interface, and a connection with the server will be established based on the input information;

[0054] The server configuration submodule is used to configure the various parameters required for the communication protocol based on the completed server communication address; among them, the parameters required for the communication protocol include station number and function code;

[0055] The template acquisition submodule is used to obtain templates to get data writing format examples under the corresponding protocol, and to modify the storage address, the data value type and value size to be sent;

[0056] The configuration saving submodule is used to save the modified configuration locally as an ini format file;

[0057] The data sending submodule is used by the client to start sending data and format the data according to the selected communication protocol;

[0058] The data transmission log module is used to record detailed information about each data transmission; the detailed information includes the transmission time and data content.

[0059] As a preferred option, the server-side includes:

[0060] The client input submodule is used to input the client's IP address and port number in the configuration interface, and a connection with the client will be established based on the input information;

[0061] The client configuration submodule is used to configure the various parameters required for the communication protocol based on the completed client communication address; among them, the parameters required for the communication protocol include station number and function code;

[0062] Modify the submodule to obtain a template and a data writing format example under this protocol, and modify the read address, the data value type to be read, and the value size;

[0063] The local save submodule is used to save the modified configuration locally as an ini format file;

[0064] The data receiving submodule is used by the server to start receiving data and format the received data according to the selected communication protocol.

[0065] The receiving log recording submodule is used to record detailed information for each data reception through data receiving logs; the detailed information for data reception includes time and data content.

[0066] More specifically, the system tests the operation of a Modbus TCP communication protocol as follows:

[0067] The first step is to start the testing software, open the communication protocol integration testing software written in Python, and operate it through the GUI interface built with the Tkinter library;

[0068] The second step is to select "Modbus TCP" as the communication protocol for testing in the protocol selection interface, and then click the "Start Client" or "Start Server" button.

[0069] The third step is client configuration, as follows:

[0070] ① Server communication address configuration: Enter the server's IP address as "192.168.1.10" and the port number as "502" in the client interface;

[0071] ② Communication protocol parameter configuration: Configure the Modbus TCP station number to "1" and the function code to "3";

[0072] ③ Data transmission configuration: Set the address of the data to be sent to "0x01" and the data value to "0x0A" (representing 10);

[0073] ④ Data transmission log recording: Automatically records details of transmitted data packets, including transmission time, data content, data value, and transmission status "successful";

[0074] If no stop signal is detected, data transmission will continue.

[0075] Step 4, server-side configuration, as follows:

[0076] ① Client communication address configuration: Enter the server's IP address as "192.168.1.20" and the port number as "502" in the server interface. The server will automatically listen for all connection requests from the client.

[0077] ② Communication protocol parameter configuration: The server configures the corresponding parameters according to the Modbus TCP protocol requirements;

[0078] ③ Data reception configuration: The server sets the address range for receiving data to "0x01" to "0x10";

[0079] ④ Data reception log recording: Records details of received data packets, including reception time, data value: "0x0A", and reception status: "successful";

[0080] If no stop signal is detected, data reception will continue.

[0081] The fifth step is to verify the test results, as follows:

[0082] Check the data sending status through the client's logs;

[0083] Verify data reception status through server-side log recording;

[0084] If both data sending and receiving are successful, it indicates that the Modbus TCP communication protocol is working normally in the corresponding test environment.

[0085] The Python-based communication protocol integration testing method, device, and medium of the present invention have the following advantages:

[0086] (i) This invention is applicable to relatively complex IoT system application scenarios and is used to solve the problems of numerous and complex communication protocols, large workload, high cost and difficulty in ensuring data reliability in the traditional communication protocol testing process;

[0087] (II) This invention comprises two parts: a master station and a slave station. The master station configures the communication address and parameters, queries the slave station for the data it wants to read, the slave station receives the signal and replies to the master station with the data, and the master station receives the data and prints the log content. Each communication protocol has a corresponding master station and slave station, integrating various communication protocols and effectively solving the time and manpower costs brought about during the testing process.

[0088] (III) This invention aims to provide a convenient software method for verifying the correctness and reliability of communication protocols. It can help testers ensure that their communication protocols work as expected and meet the system's stability requirements; at the same time, it simplifies the testing process, shortens the testing cycle, and greatly improves convenience and practicality.

[0089] (iv) By integrating communication protocols, this invention frees up human resources for separate searching and testing, simplifies the testing process, and greatly shortens the communication testing cycle.

[0090] (v) Previously, it was only possible to find a single protocol communication method and to understand various usage methods. However, this invention can support multiple communication protocols, which greatly improves convenience and practicality.

[0091] (vi) The present invention allows for free setting of communication address, protocol parameters, data address, and data value, thereby improving the flexibility of testing. Attached Figure Description

[0092] The invention will be further described below with reference to the accompanying drawings.

[0093] Appendix Figure 1 This is a flowchart illustrating a Python-based method for integrating and testing communication protocols. Detailed Implementation

[0094] The Python-based communication protocol integration testing method, device, and medium of the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments.

[0095] Example 1:

[0096] As attached Figure 1 As shown, this embodiment provides a Python-based communication protocol integration testing method. This method uses the Tkinter library to build a graphical user interface (GUI) and imports various communication modules to support multiple communication protocols. The communication modules handle the underlying interactions with different communication protocols, ensuring that data can be transmitted correctly according to the established protocols. Specifically:

[0097] S1. Select the protocol and client or server type via the graphical user interface column;

[0098] S2. Determine whether it is a client or server type:

[0099] ① If it is a client type, then execute steps S3 to S5;

[0100] ②If it is the server side, then execute steps S6 to S8;

[0101] S3. Complete the configuration of the server communication address, the parameters required for the communication protocol, the address and value of the data to be sent, and the log record of the data transmission;

[0102] S4, Send data;

[0103] S5. Determine whether to terminate the client operation:

[0104] ① If the process ends, proceed to step S9;

[0105] ②If the process has not ended, proceed to step S4;

[0106] S6. Complete the configuration of the client communication address, the parameters required for the communication protocol, the address of the received data, and the log recording of the data reception;

[0107] S7, Receive data;

[0108] S8. Determine whether to terminate server operation:

[0109] ① If the process ends, proceed to step S9;

[0110] ②If the process has not ended, proceed to step S7;

[0111] S9, End.

[0112] The specific protocol selection in this embodiment is as follows:

[0113] The user interface lists all supported communication protocol names.

[0114] ① Select the desired communication protocol from the list;

[0115] ② Choose either client or server;

[0116] ③ Open the corresponding protocol client or server operation interface.

[0117] In this embodiment, the client acts as both the data generator and sender, as detailed below:

[0118] ① Enter the server's IP address and port number in the configuration interface, and a connection with the server will be established based on the information entered;

[0119] ② After completing the server-side communication address, configure the parameters required for the communication protocol; among which, the parameters required for the communication protocol include station number and function code;

[0120] ③ Obtain the template to get the data writing format example under the corresponding protocol, and modify the storage address, the data value type and value size to be sent;

[0121] ④ Save the modified configuration locally as an ini file;

[0122] ⑤ The client begins sending data and formats the data according to the selected communication protocol;

[0123] ⑥ Record detailed information about each data transmission through the data transmission log; the detailed information includes the transmission time and data content.

[0124] In this embodiment, the server acts as the data receiver, as detailed below:

[0125] ① Enter the client's IP address and port number in the configuration interface, and a connection with the client will be established based on the information entered;

[0126] ② After completing the client communication address, configure the parameters required for the communication protocol; among which, the parameters required for the communication protocol include station number and function code;

[0127] ③ Obtain the template to get an example of the data writing format under this protocol, and modify the reading address, the data value type to be read, and the value size;

[0128] ④ Save the modified configuration locally as an ini file;

[0129] ⑤ The server begins receiving data and formats the received data according to the selected communication protocol;

[0130] ⑥ Record detailed information for each data reception through the data reception log; the detailed information for each data reception includes the time and data content.

[0131] Example 2:

[0132] This embodiment provides a Python-based communication protocol integration testing system, which includes:

[0133] Interface building module, using

[0134] The Tkinter library is used to build graphical user interfaces (GUIs).

[0135] The Modbus communication module is used to handle the low-level interaction with different communication protocols, ensuring that data can be transmitted correctly according to the established protocol.

[0136] The protocol selection module is used to display various communication protocol names in a list on a graphical user interface, providing an entry point to open the communication protocol client or server;

[0137] The client, as the data generator and sender, is used for configuring the server's communication address, configuring the parameters required for the communication protocol, configuring the address and value of the data to be sent, and logging the data transmission.

[0138] The server, acting as the data receiver, is used for configuring the client's communication address, configuring the parameters required for the communication protocol, configuring the address of the received data, and logging the data reception.

[0139] The protocol selection module in this embodiment includes:

[0140] List submodules to list all supported communication protocol names through a user interface list;

[0141] The communication protocol selection submodule is used to select the desired communication protocol from the list;

[0142] The port selection submodule is used to select either the client or the server.

[0143] Open submodules are used to open the operation interface of the corresponding protocol client or server.

[0144] The client in this embodiment includes:

[0145] The server-side input submodule is used to input the server's IP address and port number in the configuration interface, and a connection with the server will be established based on the input information;

[0146] The server configuration submodule is used to configure the various parameters required for the communication protocol based on the completed server communication address; among them, the parameters required for the communication protocol include station number and function code;

[0147] The template acquisition submodule is used to obtain templates to get data writing format examples under the corresponding protocol, and to modify the storage address, the data value type and value size to be sent;

[0148] The configuration saving submodule is used to save the modified configuration locally as an ini format file;

[0149] The data sending submodule is used by the client to start sending data and format the data according to the selected communication protocol;

[0150] The data transmission log module is used to record detailed information about each data transmission; the detailed information includes the transmission time and data content.

[0151] The server in this embodiment includes:

[0152] The client input submodule is used to input the client's IP address and port number in the configuration interface, and a connection with the client will be established based on the input information;

[0153] The client configuration submodule is used to configure the various parameters required for the communication protocol based on the completed client communication address; among them, the parameters required for the communication protocol include station number and function code;

[0154] Modify the submodule to obtain a template and a data writing format example under this protocol, and modify the read address, the data value type to be read, and the value size;

[0155] The local save submodule is used to save the modified configuration locally as an ini format file;

[0156] The data receiving submodule is used by the server to start receiving data and format the received data according to the selected communication protocol.

[0157] The receiving log recording submodule is used to record detailed information for each data reception through data receiving logs; the detailed information for data reception includes time and data content.

[0158] The specific process of testing the Modbus TCP communication protocol in this system is as follows:

[0159] The first step is to start the testing software, open the communication protocol integration testing software written in Python, and operate it through the GUI interface built with the Tkinter library;

[0160] The second step is to select "Modbus TCP" as the communication protocol for testing in the protocol selection interface, and then click the "Start Client" or "Start Server" button.

[0161] The third step is client configuration, as follows:

[0162] ① Server communication address configuration: Enter the server's IP address as "192.168.1.10" and the port number as "502" in the client interface;

[0163] ② Communication protocol parameter configuration: Configure the Modbus TCP station number to "1" and the function code to "3";

[0164] ③ Data transmission configuration: Set the address of the data to be sent to "0x01" and the data value to "0x0A" (representing 10);

[0165] ④ Data transmission log recording: Automatically records details of transmitted data packets, including transmission time, data content, data value, and transmission status "successful";

[0166] If no stop signal is detected, data transmission will continue.

[0167] Step 4, server-side configuration, as follows:

[0168] ① Client communication address configuration: Enter the server's IP address as "192.168.1.20" and the port number as "502" in the server interface. The server will automatically listen for all connection requests from the client.

[0169] ② Communication protocol parameter configuration: The server configures the corresponding parameters according to the Modbus TCP protocol requirements;

[0170] ③ Data reception configuration: The server sets the address range for receiving data to "0x01" to "0x10";

[0171] ④ Data reception log recording: Records details of received data packets, including reception time, data value: "0x0A", and reception status: "successful";

[0172] If no stop signal is detected, data reception will continue.

[0173] The fifth step is to verify the test results, as follows:

[0174] Check the data sending status through the client's logs;

[0175] Verify data reception status through server-side log recording;

[0176] If both data sending and receiving are successful, it indicates that the Modbus TCP communication protocol is working normally in the corresponding test environment.

[0177] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A Python-based method for integrating and testing communication protocols, characterized in that... This method uses the Tkinter library to build a graphical user interface and imports various communication modules to support multiple communication protocols. These communication modules handle the low-level interaction with different communication protocols, ensuring that data is transmitted correctly according to the established protocols. Specifically: S1. Select the protocol and client or server type via the graphical user interface column; S2. Determine whether it is a client or server type: ① If it is a client type, then execute steps S3 to S5; ②If it is the server side, then execute steps S6 to S8; S3. Complete the configuration of the server communication address, the parameters required for the communication protocol, the address and value of the data to be sent, and the log record of the data transmission; S4, Send data; S5. Determine whether to terminate the client operation: ① If the process ends, proceed to step S9; ②If the process has not ended, proceed to step S4; S6. Complete the configuration of the client communication address, the parameters required for the communication protocol, the address of the received data, and the log recording of the data reception; S7, Receive data; S8. Determine whether to terminate server operation: ① If the process ends, proceed to step S9; ②If the process has not ended, proceed to step S7; S9, End; The specific protocol selection is as follows: The user interface lists all supported communication protocol names. Select the desired communication protocol from the list; Choose either client or server; Open the corresponding protocol client or server interface; The client acts as both the generator and sender of data, specifically as follows: Enter the server's IP address and port number in the configuration interface, and a connection with the server will be established based on the information entered. After completing the server-side communication address, configure the parameters required for the communication protocol; these parameters include the station number and function code. Obtain the template to get a data writing format example under the corresponding protocol, and modify the storage address, the data value type and value size to be sent; Save the modified configuration locally as an ini file; The client begins sending data, formatting it according to the selected communication protocol; The data transmission log records detailed information about each data transmission; this information includes the transmission time and data content. The server acts as the data receiver, as follows: Enter the client's IP address and port number in the configuration interface, and a connection with the client will be established based on the information entered; After completing the client communication address, configure the parameters required for the communication protocol; these parameters include station number and function code. Obtain the template to get an example of the data writing format under this protocol, and modify the reading address, the data value type to be read, and the value size; Save the modified configuration locally as an ini file; The server begins receiving data and formats the received data according to the selected communication protocol; The data reception log records detailed information about each data reception, including the time and data content.

2. A Python-based communication protocol integration testing system, characterized in that, The system includes: The interface building module is used to build graphical user interfaces using the Tkinter library; The communication module is used to handle the underlying interaction with different communication protocols, ensuring that data can be transmitted correctly according to the established protocol. The protocol selection module is used to display various communication protocol names in a list on a graphical user interface, providing an entry point to open the communication protocol client or server; The client, as the data generator and sender, is used for configuring the server's communication address, configuring the parameters required for the communication protocol, configuring the address and value of the data to be sent, and logging the data transmission. The server, acting as the data receiver, is used for configuring the client's communication address, configuring the parameters required for the communication protocol, configuring the address of the received data, and logging the data reception. The protocol selection module includes: List submodules to list all supported communication protocol names through a user interface list; The communication protocol selection submodule is used to select the desired communication protocol from the list; The port selection submodule is used to select either the client or the server. Open submodule, used to open the operation interface of the corresponding protocol client or server; The client includes: The server-side input submodule is used to input the server's IP address and port number in the configuration interface, and a connection with the server will be established based on the input information; The server configuration submodule is used to configure the various parameters required for the communication protocol based on the completed server communication address; among them, the parameters required for the communication protocol include station number and function code; The template acquisition submodule is used to obtain templates to get data writing format examples under the corresponding protocol, and to modify the storage address, the data value type and value size to be sent; The configuration saving submodule is used to save the modified configuration locally as an ini format file; The data sending submodule is used by the client to start sending data and format the data according to the selected communication protocol; The data transmission log module is used to record detailed information about each data transmission; the detailed information includes the transmission time and data content. The server includes: The client input submodule is used to input the client's IP address and port number in the configuration interface, and a connection with the client will be established based on the input information; The client configuration submodule is used to configure the various parameters required for the communication protocol based on the completed client communication address; among them, the parameters required for the communication protocol include station number and function code; Modify the submodule to obtain a template and a data writing format example under this protocol, and modify the read address, the data value type to be read, and the value size; The local save submodule is used to save the modified configuration locally as an ini format file; The data receiving submodule is used by the server to start receiving data and format the received data according to the selected communication protocol. The receiving log recording submodule is used to record detailed information for each data reception through data receiving logs; the detailed information for data reception includes time and data content; The specific process of testing the Modbus TCP communication protocol in this system is as follows: The first step is to start the testing software, open the communication protocol integration testing software written in Python, and operate it through the GUI interface built with the Tkinter library; The second step is to select "Modbus TCP" as the communication protocol for testing in the protocol selection interface, and then click the "Start Client" or "Start Server" button. The third step is client configuration, as follows: ① Server communication address configuration: Enter the server's IP address as "192.168.1.10" and the port number as "502" in the client interface; ② Communication protocol parameter configuration: Configure the Modbus TCP station number to "1" and the function code to "3"; ③ Data transmission configuration: Set the data address to be sent to "0x01" and the data value to "0x0A"; ④ Data transmission log recording: Automatically records details of transmitted data packets, including transmission time, data content, data value, and transmission status "successful"; If no stop signal is detected, data transmission will continue. Step 4, server-side configuration, as follows: ① Client communication address configuration: Enter the server's IP address as "192.168.1.20" and the port number as "502" in the server interface. The server will automatically listen for all connection requests from the client. ② Communication protocol parameter configuration: The server configures the corresponding parameters according to the Modbus TCP protocol requirements; ③ Data reception configuration: The server sets the address range for receiving data to "0x01" to "0x10"; ④ Data reception log recording: Records details of received data packets, including reception time, data value: "0x0A", and reception status "successful"; If no stop signal is detected, data reception will continue. The fifth step is to verify the test results, as follows: Check the data sending status through the client's logs; Verify data reception status through server-side log recording; If both data sending and receiving are successful, it indicates that the Modbus TCP communication protocol is working normally in the corresponding test environment.

Citation Information

Patent Citations

  • Mcok testing method and system, electronic equipment and readable storage medium

    CN110162464A