OPC UA server search method based on port query

By monitoring the status of the user terminal, building a virtual port and selecting the OPC UA server for data processing, the problem that the user terminal cannot quickly connect to the OPC UA server is solved, and efficient data-assisted computing processing is achieved.

CN116821215BActive Publication Date: 2025-08-05HUIZHIAN INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211521763.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-30
Publication Date
2025-08-05
Estimated Expiration
2042-11-30

AI Technical Summary

Technical Problem

When user terminals need large data operations, they cannot quickly connect to the OPC UA server, resulting in an increase in data operations load.

Method used

By monitoring the application status of the user terminal, building a virtual port and sending a broadcast inquiry message, generating a server list, selecting a matching OPC UA server for data processing, and interrupting the connection after completing the task, obtaining IP address information to achieve fast connection.

Benefits of technology

Improves the connection reliability and data-assisted computing processing efficiency between the user terminal and the OPC UA server.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116821215B_ABST
    Figure CN116821215B_ABST
Patent Text Reader

Abstract

The present invention provides an OPC UA server search method based on port query. By constructing a virtual port in a user terminal, the method obtains the IP address information of all OPC UA servers in a local area network, thereby facilitating a rapid search for a matching OPC UA server, thereby achieving a fast connection between the user terminal and the OPC UA server, and improving the reliability and efficiency of the data-assisted computing processing provided by the OPC UA server to the user terminal.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of OPC UA server management, and in particular to an OPC UA server search method based on port query. Background Art

[0002] The computing power of user terminals such as mobile phones is limited. When the application of the user terminal needs to perform computing and processing on a large amount of data, the user terminal needs to connect to the corresponding OPC UA server to perform data-assisted computing and processing. User terminals in the existing technology all connect to the designated OPC UA server based on the IP address of the designated OPC UA server, and disconnect from the designated OPC UA server after completing the data-assisted computing and processing. If the user terminal cannot obtain the IP address of the designated OPC UA server, it will not be able to connect to the OPC UA server, and thus it will not be able to use the OPC UA server to provide the user terminal with corresponding data-assisted computing and processing, which will increase the data computing load of the user terminal itself. Summary of the Invention

[0003] To address the deficiencies in the prior art, the present invention provides an OPC UA server search method based on port query. The method monitors a user terminal to determine whether an application of the user terminal needs to access an OPC UA server, and obtains task status information of all pending tasks of the application that needs to access the OPC UA server. The method instructs the user terminal to establish a virtual port for the OPC UA protocol and instructs the application to send a broadcast query message to the local area network through the virtual port. A server list is generated based on response messages to the broadcast query message from all OPC UA servers within the local area network, and a matching OPC UA service is searched from the server list. The OPC UA server obtained by the search receives and processes pending task data from the user terminal, and after completing the processing of the pending task data, the connection between the user terminal and the OPC UA server is terminated. By establishing a virtual port on the user terminal, the method obtains the IP address information of all OPC UA servers within the local area network, facilitating a rapid search for a matching OPC UA server, thereby achieving a rapid connection between the user terminal and the OPC UA server and improving the reliability and efficiency of the OPC UA server in providing data-assisted computing and processing to the user terminal.

[0004] The present invention provides an OPC UA server search method based on port query, which includes the following steps:

[0005] Step S1: Monitor a user terminal to obtain the running status information of the current application of the user terminal; determine whether the application of the user terminal needs to access the OPC UA server based on the running status information, and obtain the task status information of all pending tasks of the application that needs to access the OPC UA server;

[0006] Step S2: integrating all pending tasks into a corresponding pending task sequence based on the task status information; instructing the user terminal to construct a virtual port for the OPC UA protocol, assigning the virtual port to the application, and instructing the application to send a broadcast query message to the local area network through the virtual port;

[0007] Step S3: generating a server list of all OPC UA servers within the local area network based on response messages from all OPC UA servers within the local area network to the broadcast query message; when the application needs to process one of the pending tasks in the pending task sequence, obtaining task status information corresponding to the pending task, and searching for a matching OPC UA server from the server list based on the task status information, thereby establishing a communication link between the virtual port and the searched OPC UA server;

[0008] Step S4: Sending the pending task data corresponding to the pending task to the corresponding OPC UA server through the communication link. When the OPC UA server completes processing the pending task data, the communication link between the virtual port and the OPC UA server is interrupted.

[0009] Furthermore, in step S1, monitoring the user terminal to obtain the current running status information of the application program of the user terminal specifically includes:

[0010] The task manager of the user terminal is monitored, and the memory usage of the current running process of the application is extracted from the task manager as the running status information.

[0011] Furthermore, in step S1, judging whether the application of the user terminal needs to access the OPC UA server based on the running status information, and obtaining task status information of all pending tasks of the application that needs to access the OPC UA server specifically includes:

[0012] If the memory usage is greater than or equal to a preset usage threshold, it is determined that the application of the user terminal needs to access the OPC UA server; otherwise, it is determined that the application of the user terminal does not need to access the OPC UA server;

[0013] When the application of the user terminal needs to access the OPC UA server, the amount of to-be-processed task data of each of all to-be-processed tasks run by the application is obtained as the task status information.

[0014] Furthermore, in step S2, according to the task status information, integrating all pending tasks into a corresponding pending task sequence specifically includes:

[0015] According to the order of the number of tasks to be processed of all tasks to be processed from large to small, the tasks to be processed are arranged in sequence to form a corresponding sequence of tasks to be processed.

[0016] Furthermore, in step S2, instructing the user terminal to construct a virtual port for the OPC UA protocol, assigning the virtual port to the application, and instructing the application to send a broadcast query message to the local area network through the virtual port specifically includes:

[0017] Instruct the user terminal to construct a virtual port for the OPC UA protocol in the socket, assign the virtual port to the application, and thereby establish a connection channel between the virtual port and the application; instruct the application to periodically send broadcast query messages to the local area network through the virtual port until all OPC UA servers in the local area network return response messages.

[0018] Furthermore, in step S3, generating a server list of all OPC UA servers within the local area network based on response messages of all OPC UA servers within the local area network to the broadcast query message specifically includes:

[0019] Extracting IP address information of each OPC UA server in the local area network from response messages of all OPC UA servers in the local area network to the broadcast query message, and generating a server list of all OPC UA servers in the local area network based on the IP address information.

[0020] Furthermore, in step S3, when the application needs to process one of the pending tasks in the pending task sequence, task status information of the corresponding pending task is obtained, and a matching OPC UA server is searched from the server list based on the task status information, thereby establishing a communication link between the virtual port and the searched OPC UA server. Specifically, the process includes:

[0021] When the application needs to process one of the pending tasks in the pending task sequence, obtaining the pending task data volume corresponding to the pending task;

[0022] According to the amount of data of the task to be processed, searching from the server list an OPC UA server having a data processing speed matching the amount of data of the task to be processed;

[0023] According to the IP address information of the OPC US server obtained by the search, a communication link is established between the virtual port and the OPC UA server obtained by the search.

[0024] Furthermore, in step S4, sending the pending task data corresponding to the pending task to the corresponding OPC UA server via the communication link, and after the OPC UA server completes processing the pending task data, interrupting the communication link between the virtual port and the OPC UA server specifically includes:

[0025] Packaging the pending task data corresponding to the pending task and sending it to the corresponding OPC UA server via the communication link;

[0026] When the OPC UA server completes processing of the task data to be processed and returns the processed result to the user terminal through the communication link, the communication link between the virtual port and the OPC UA server is interrupted.

[0027] Compared with the prior art, the port query-based OPC UA server search method monitors the user terminal to determine whether the user terminal's application needs to access the OPC UA server, and obtains the task status information of all pending tasks of the application that needs to access the OPC UA server; instructs the user terminal to build a virtual port for the OPC UA protocol, and instructs the application to send a broadcast query message to the local area network through the virtual port; generates a server list based on the response messages of all OPC UA servers in the local area network to the broadcast query message, searches for a matching OPC UA service from the server list, uses the searched OPC UA server to receive and process the pending task data from the user terminal, and disconnects the user terminal from the OPC UA server after completing the processing of the pending task data. By building a virtual port in the user terminal, it obtains the IP address information of all OPC UA servers in the local area network, facilitates the rapid search for a matching OPC UA server, thereby achieving a fast connection between the user terminal and the OPC UA server, and improving the reliability and efficiency of the OPC UA server in providing data-assisted computing processing to the user terminal.

[0028] Other features and advantages of the present invention will be described in the following description, and in part will become apparent from the description, or will be understood by practicing the present invention. The purposes and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings.

[0029] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0031] Figure 1 A flow chart of the OPC UA server search method based on port query provided by the present invention. DETAILED DESCRIPTION

[0032] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.

[0033] See Figure 1 , which is a flow chart of an OPC UA server search method based on port query provided by an embodiment of the present invention. The OPC UA server search method based on port query includes the following steps:

[0034] Step S1: Monitor a user terminal to obtain the running status information of the current application of the user terminal; based on the running status information, determine whether the application of the user terminal needs to access the OPC UA server, and obtain the task status information of all pending tasks of the application that needs to access the OPC UA server;

[0035] Step S2: Integrate all pending tasks into a corresponding pending task sequence based on the task status information; instruct the user terminal to construct a virtual port for the OPC UA protocol, assign the virtual port to the application, and instruct the application to send a broadcast query message to the local area network through the virtual port;

[0036] Step S3: Generate a server list of all OPC UA servers within the local area network based on the response messages from all OPC UA servers within the local area network to the broadcast query message. When the application needs to process one of the pending tasks in the pending task sequence, obtain task status information of the corresponding pending task and, based on the task status information, search for a matching OPC UA server from the server list, thereby establishing a communication link between the virtual port and the searched OPC UA server.

[0037] Step S4: Send the pending task data corresponding to the pending task to the corresponding OPC UA server through the communication link. When the OPC UA server completes processing the pending task data, the communication link between the virtual port and the OPC UA server is interrupted.

[0038] The beneficial effects of the above technical solution are as follows: the port query-based OPC UA server search method determines whether the user terminal's application needs to access the OPC UA server by monitoring the user terminal, and obtains task status information of all pending tasks of the application that needs to access the OPC UA server; instructs the user terminal to build a virtual port for the OPC UA protocol, and instructs the application to send a broadcast query message to the local area network through the virtual port; generates a server list based on the response messages of all OPC UA servers in the local area network to the broadcast query message, searches for a matching OPC UA service from the server list, uses the searched OPC UA server to receive and process the pending task data from the user terminal, and disconnects the user terminal from the OPC UA server after completing the processing of the pending task data. By building a virtual port in the user terminal, the IP address information of all OPC UA servers in the local area network is obtained, which facilitates the rapid search for a matching OPC UA server, thereby achieving a fast connection between the user terminal and the OPC UA server, and improving the reliability and efficiency of the OPC UA server in providing data-assisted computing and processing to the user terminal.

[0039] Preferably, in step S1, monitoring the user terminal to obtain the current running status information of the application of the user terminal specifically includes:

[0040] The task manager of the user terminal is monitored, and the memory usage of the current running process of the application is extracted from the task manager as the running status information.

[0041] The beneficial effect of the above technical solution is: through the above method, the current application of the user terminal can be comprehensively monitored, and the memory usage of the application currently running in the front-end state of the user terminal can be effectively determined, which facilitates the subsequent screening of applications that need to be connected to the OPC UA server from different applications.

[0042] Preferably, in step S1, judging whether the application of the user terminal needs to access the OPC UA server based on the running status information, and obtaining the task status information of all pending tasks of the application that needs to access the OPC UA server specifically includes:

[0043] If the memory usage is greater than or equal to a preset usage threshold, it is determined that the application of the user terminal needs to be connected to the OPC UA server; otherwise, it is determined that the application of the user terminal does not need to be connected to the OPC UA server;

[0044] When the application of the user terminal needs to access the OPC UA server, the amount of pending task data of all pending tasks run by the application is obtained as the task status information.

[0045] The beneficial effect of the above technical solution is: through the above method, taking the memory usage of the application as the benchmark, when the memory usage is greater than or equal to the preset usage threshold, it indicates that the current data processing load of the application is large, and it needs to connect to the OPC UA server to perform corresponding data-assisted calculation processing. This can avoid the user terminal from excessively connecting to different OPC UA servers and improve the utilization efficiency of the OPC US server.

[0046] Preferably, in step S2, integrating all pending tasks into a corresponding pending task sequence according to the task status information specifically includes:

[0047] According to the order of the number of tasks to be processed of all tasks to be processed from large to small, the tasks to be processed are arranged in sequence to form a corresponding sequence of tasks to be processed.

[0048] The beneficial effect of the above technical solution is that: through the above method, all pending tasks of the application can be arranged in order, which facilitates the application to process all pending tasks in an orderly manner and avoids task processing confusion.

[0049] Preferably, in step S2, instructing the user terminal to construct a virtual port for the OPC UA protocol, assigning the virtual port to the application, and instructing the application to send a broadcast inquiry message to the local area network through the virtual port specifically includes:

[0050] Instruct the user terminal to build a virtual port for the OPC UA protocol in the socket, assign the virtual port to the application, and thus establish a connection channel between the virtual port and the application; instruct the application to periodically send broadcast query messages to the local area network through the virtual port until all OPC UA servers in the local area network return response messages.

[0051] The beneficial effects of the above technical solution are: through the above method, the user terminal is instructed to build a virtual port for the OPC UA protocol in the socket, and the virtual port is used as a connection intermediary between the application and the OPC UA server, so that compatible data communication is carried out between the application and the OPC UA server, and the communication reliability between the application and the OPC UA server is guaranteed; in addition, broadcast query messages are regularly sent to the local area network through the virtual port, which can improve the accuracy and comprehensive coverage of the broadcast query message sending.

[0052] Preferably, in step S3, generating a server list of all OPC UA servers within the local area network based on response messages of all OPC UA servers within the local area network to the broadcast query message specifically includes:

[0053] The IP address information of each OPC UA server in the local area network is extracted from the response messages of all OPC UA servers in the local area network to the broadcast query message, and a server list of all OPC UA servers in the local area network is generated based on the IP address information.

[0054] The beneficial effect of the above technical solution is: through the above method, the IP address information of all OPC UA servers within the local area network can be obtained, which facilitates subsequent user terminals to accurately select the appropriate OPC US server for connection, and effectively reduces the connection error rate between user terminals and OPC UA servers.

[0055] Preferably, in step S3, when the application needs to process one of the pending tasks in the pending task sequence, task status information of the corresponding pending task is obtained, and a matching OPC UA server is searched from the server list based on the task status information, thereby establishing a communication link between the virtual port and the searched OPC UA server. Specifically, the process includes:

[0056] When the application needs to process one of the pending tasks in the pending task sequence, the pending task data volume of the corresponding pending task is obtained;

[0057] According to the data volume of the task to be processed, searching the server list for an OPC UA server having a data processing speed matching the data volume of the task to be processed;

[0058] According to the IP address information of the OPC US server obtained by the search, a communication link is established between the virtual port and the OPC UA server obtained by the search.

[0059] The beneficial effect of the above technical solution is: through the above method, it can be ensured that each time the application processes a pending task, it is always connected to only one OPC UA server, thereby ensuring the data processing efficiency of the OPC UA server for the pending task.

[0060] Preferably, in step S4, sending the pending task data corresponding to the pending task to the corresponding OPC UA server via the communication link, and after the OPC UA server completes processing the pending task data, interrupting the communication link between the virtual port and the OPC UA server specifically includes:

[0061] Packing the pending task data corresponding to the pending task and sending it to the corresponding OPC UA server through the communication link;

[0062] After the OPC UA server completes processing of the task data to be processed and returns the processed result to the user terminal through the communication link, the communication link between the virtual port and the OPC UA server is interrupted.

[0063] The beneficial effect of the above technical solution is: through the above method, it can be ensured that when the OPC UA server completes the processing of the corresponding pending task data, it will still disconnect from the user terminal, so that when the application of the user terminal processes the next pending task, it can reselect another matching OPC UA server for connection, thereby improving the processing efficiency of the pending tasks and the connection operation efficiency of the OPC UA server.

[0064] As can be seen from the contents of the above embodiment, the port query-based OPC UA server search method monitors the user terminal to determine whether the user terminal's application needs to access the OPC UA server, and obtains the task status information of all pending tasks of the application that needs to access the OPC UA server; instructs the user terminal to build a virtual port for the OPC UA protocol, and instructs the application to send a broadcast query message to the local area network through the virtual port; generates a server list based on the response messages of all OPC UA servers in the local area network to the broadcast query message, searches for a matching OPC UA service from the server list, uses the searched OPC UA server to receive and process the pending task data from the user terminal, and disconnects the user terminal from the OPC UA server after completing the processing of the pending task data. By building a virtual port in the user terminal, the IP address information of all OPC UA servers in the local area network is obtained, which facilitates the rapid search for a matching OPC UA server, thereby achieving a fast connection between the user terminal and the OPC UA server, and improving the reliability and efficiency of the OPC UA server in providing data-assisted computing processing to the user terminal.

[0065] Obviously, those skilled in the art may make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if such changes and modifications fall within the scope of the claims and their equivalents, the present invention is intended to include such changes and modifications.

Claims

1. An OPC UA server search method based on port query, characterized in that: It includes the following steps: Step S1: Monitor a user terminal to obtain the running status information of the current application of the user terminal; determine whether the application of the user terminal needs to access the OPC UA server based on the running status information, and obtain the task status information of all pending tasks of the application that needs to access the OPC UA server; Step S2: integrating all pending tasks into a corresponding pending task sequence based on the task status information; instructing the user terminal to construct a virtual port for the OPC UA protocol, assigning the virtual port to the application, and instructing the application to send a broadcast query message to the local area network through the virtual port; Step S3: generating a server list of all OPC UA servers within the local area network based on response messages from all OPC UA servers within the local area network to the broadcast query message; when the application needs to process one of the pending tasks in the pending task sequence, obtaining task status information corresponding to the pending task, and searching for a matching OPC UA server from the server list based on the task status information, thereby establishing a communication link between the virtual port and the searched OPC UA server; Step S4: Sending the pending task data corresponding to the pending task to the corresponding OPC UA server through the communication link. When the OPC UA server completes processing the pending task data, the communication link between the virtual port and the OPC UA server is interrupted.

2. The OPC UA server search method based on port query according to claim 1, characterized in that: In step S1, monitoring the user terminal to obtain the current running status information of the application program of the user terminal specifically includes: The task manager of the user terminal is monitored, and the memory usage of the current running process of the application is extracted from the task manager as the running status information.

3. The OPC UA server search method based on port query according to claim 2, characterized in that: In step S1, judging whether the application of the user terminal needs to access the OPC UA server based on the running status information, and obtaining the task status information of all pending tasks of the application that needs to access the OPC UA server specifically includes: If the memory usage is greater than or equal to a preset usage threshold, it is determined that the application of the user terminal needs to access the OPC UA server; otherwise, it is determined that the application of the user terminal does not need to access the OPC UA server; When the application of the user terminal needs to access the OPC UA server, the amount of to-be-processed task data of each of all to-be-processed tasks run by the application is obtained as the task status information.

4. The OPC UA server search method based on port query according to claim 3, characterized in that: In step S2, according to the task status information, integrating all pending tasks into a corresponding pending task sequence specifically includes: According to the order of the number of tasks to be processed of all tasks to be processed from large to small, the tasks to be processed are arranged in sequence to form a corresponding sequence of tasks to be processed.

5. The OPC UA server search method based on port query according to claim 4, characterized in that: In step S2, instructing the user terminal to construct a virtual port for the OPC UA protocol, assigning the virtual port to the application, and instructing the application to send a broadcast inquiry message to the local area network through the virtual port specifically includes: Instruct the user terminal to construct a virtual port for the OPC UA protocol in the socket, assign the virtual port to the application, and thereby establish a connection channel between the virtual port and the application; instruct the application to periodically send broadcast query messages to the local area network through the virtual port until all OPC UA servers in the local area network return response messages.

6. The OPC UA server search method based on port query according to claim 5, characterized in that: In step S3, generating a server list of all OPC UA servers within the local area network based on response messages of all OPC UA servers within the local area network to the broadcast query message specifically includes: Extracting IP address information of each OPC UA server in the local area network from response messages of all OPC UA servers in the local area network to the broadcast query message, and generating a server list of all OPC UA servers in the local area network based on the IP address information.

7. The OPC UA server search method based on port query according to claim 6, characterized in that: In step S3, when the application needs to process one of the pending tasks in the pending task sequence, task status information of the corresponding pending task is obtained, and a matching OPC UA server is searched from the server list based on the task status information, thereby establishing a communication link between the virtual port and the searched OPC UA server. Specifically, the steps include: When the application needs to process one of the pending tasks in the pending task sequence, obtaining the pending task data volume corresponding to the pending task; According to the amount of data of the task to be processed, searching from the server list an OPC UA server having a data processing speed matching the amount of data of the task to be processed; According to the IP address information of the OPC US server obtained by the search, a communication link is established between the virtual port and the OPC UA server obtained by the search.

8. The OPC UA server search method based on port query according to claim 7, characterized in that: In step S4, sending the pending task data corresponding to the pending task to the corresponding OPC UA server through the communication link, and after the OPC UA server completes processing of the pending task data, interrupting the communication link between the virtual port and the OPC UA server specifically includes: Packaging the pending task data corresponding to the pending task and sending the data to the corresponding OPC UA server via the communication link; When the OPC UA server completes processing of the task data to be processed and returns the processed result to the user terminal through the communication link, the communication link between the virtual port and the OPC UA server is interrupted.

Citation Information

Patent Citations

  • Method, system and computer program product for managing OPC UA server capacity

    CN111567010A

  • Working method of OPC UA server based on numerical control system

    CN114390100A