Base station and server connection control method and device, storage medium

By receiving the target connection request issued by the base station, obtaining and processing the process messages of each server, and creating threads to connect independently, the problem of low connection efficiency between the base station and the server is solved, and efficient multi-server connection and data transmission are achieved.

CN116055545BActive Publication Date: 2024-09-13SUNWAVE COMM
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310100605.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-17
Publication Date
2024-09-13
Estimated Expiration
2043-01-17

AI Technical Summary

Technical Problem

The connection efficiency between the base station and the server is low, which may cause task conflicts and response delays when connecting to multiple servers, affecting the stability and efficiency of data transmission.

Method used

By receiving the target connection request issued by the base station, the process message of each server is obtained, and a thread is created for each process message to ensure that multiple servers are independently connected to the base station, avoiding conflicts and improving connection efficiency. Specific steps include creating httpclient objects and oamClient objects, obtaining configuration data and historical connection status, generating target process messages, and processing data transmission through multi-threading.

Benefits of technology

The process of multiple servers connecting to the base station at the same time is realized to be independent of each other, reducing conflicts, improving the connection efficiency between the base station and the server, and ensuring the stability and efficiency of data transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116055545B
    Figure CN116055545B
Patent Text Reader

Abstract

The present application discloses a connection control method and device between a base station and a server, and a storage medium. The connection control method between the base station and the server comprises: receiving a target connection request issued by the base station, wherein the target connection request is used to request that multiple servers be connected to the base station; responding to the target connection request, obtaining a process message of each of the multiple servers from the base station to obtain multiple target process messages, wherein the target process message is used to indicate the process of connecting the corresponding server to the base station; creating a thread for each of the multiple target process messages to obtain multiple target threads, wherein the target thread is used to transmit the corresponding target process message to the corresponding server, and the server is used to connect to the base station according to the received target process message. The above technical solution is adopted to solve the problems of low connection efficiency between the base station and the server in the related technology.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a method and device for controlling connection between a base station and a server, and a storage medium. Background Art

[0002] Base stations and servers are important transmission equipment in the communication process. The connection efficiency and stability between them are directly related to the quality and efficiency of communication.

[0003] At present, with the development of communication services, in actual applications, base stations often need to connect to more than one server. However, in the single-threaded software processing of the base station, after connecting to one server, connecting to another server may cause task conflicts, and even the connection request may not be responded to in time, and the communications between servers may not interfere with each other. The base station needs to solve various problems caused by connecting to multiple servers at the same time, which affects data transmission.

[0004] With regard to the problems in related technologies such as low connection efficiency between base stations and servers, no effective solutions have been proposed yet. Summary of the invention

[0005] The embodiments of the present application provide a method and device for controlling the connection between a base station and a server, and a storage medium, so as to at least solve the problem of low connection efficiency between the base station and the server in the related art.

[0006] According to an embodiment of the present application, a connection control method between a base station and a server is provided, including:

[0007] receiving a target connection request sent by a base station, wherein the target connection request is used to request to connect multiple servers to the base station;

[0008] In response to the target connection request, obtaining a process message of each of the multiple servers from the base station to obtain multiple target process messages, wherein the target process message is used to indicate a process of connecting the corresponding server to the base station;

[0009] A thread is created for each of the multiple target process messages to obtain multiple target threads, wherein the target thread is used to transmit the corresponding target process message to the corresponding server, and the server is used to connect to the base station according to the received target process message.

[0010] Optionally, creating a thread for each target process message in the multiple target process messages to obtain multiple target threads includes:

[0011] Creating an httpclient object for each of the multiple target process messages to obtain multiple httpclient objects, wherein the httpclient objects correspond to the servers one by one;

[0012] Each of the multiple httpclient objects is controlled to create a thread, thereby obtaining multiple target threads.

[0013] Optionally, controlling each of the plurality of httpclient objects to create a thread to obtain the plurality of target threads includes:

[0014] Control the httpclient object to call the pthread_mutex_init function to initialize the thread and obtain the initial thread;

[0015] After the initialization thread is completed, the httpclient object is controlled to call the pthread_create function to create the initial thread as the target thread.

[0016] Optionally, the acquiring, from the base station, a process message of each of the multiple servers includes:

[0017] Creating an oamClient object for each of the multiple servers to obtain multiple oamClient objects;

[0018] Controlling each of the multiple oamClient objects to obtain configuration data of a corresponding server from the base station, and read a historical connection status of the base station, wherein the configuration data includes installation parameters and connection parameters, the installation parameters are used to indicate installation information of the corresponding server connecting to the base station, the connection parameters are used to indicate whether the base station currently initiates a connection, and the historical connection status is used to indicate a connection status of the base station before the last restart;

[0019] A process message corresponding to each of the servers is generated according to the configuration data and the historical connection status.

[0020] Optionally, generating a process message corresponding to each server according to the configuration data and the historical connection status includes:

[0021] Acquire a reference process message for the server to connect to the base station, wherein the reference process message is used to indicate a connection process required for the server to connect to the base station for the first time;

[0022] Removing the connection process before the historical connection state in the reference process message to obtain a candidate process message;

[0023] The configuration data is added to the candidate process message to obtain the target process message.

[0024] Optionally, after creating a thread for each of the multiple target process messages, the method further includes:

[0025] In the case where it is detected that the base station sends target data to the corresponding server through the target thread, detecting the current state of the httpclient object corresponding to the server;

[0026] In the case where the current state indicates that the httpclient object is in a target transmission state, adding the target data to a transmission queue, wherein the target transmission state includes an idle state, a sending state, and a waiting state;

[0027] When the current state indicates that the httpclient object is not in the target transmission state, adding the target data to the transmission queue is prohibited.

[0028] Optionally, after creating a thread for each of the multiple target process messages, the method further includes:

[0029] Acquire initial data sent from the base station to be transmitted to the target server;

[0030] Obtain the curl_easy_setopt function from the libcurl library to set the initial data to a target format, thereby obtaining target data, wherein the target format is a format that the corresponding target server allows to be recognized;

[0031] Parsing the target data through the httpclient object corresponding to the target server to obtain parsed data;

[0032] The parsed data is sent to the target server through a thread corresponding to the target server.

[0033] According to another embodiment of the embodiment of the present application, there is also provided a connection control device between a base station and a server, including:

[0034] A receiving module, configured to receive a target connection request sent by a base station, wherein the target connection request is used to request to connect multiple servers to the base station;

[0035] A first acquisition module, configured to respond to the target connection request, acquire a process message of each of the plurality of servers from the base station, and obtain a plurality of target process messages, wherein the target process message is used to indicate a process of connecting the corresponding server to the base station;

[0036] A creation module is used to create a thread for each target process message in the multiple target process messages to obtain multiple target threads, wherein the target thread is used to transmit the corresponding target process message to the corresponding server, and the server is used to connect to the base station according to the received target process message.

[0037] According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned connection control method between the base station and the server when running.

[0038] According to another aspect of an embodiment of the present application, an electronic device is also provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the connection control method between the base station and the server through the computer program.

[0039] In an embodiment of the present application, a target connection request issued by a base station is received, wherein the target connection request is used to request that multiple servers be connected to the base station; in response to the target connection request, a process message of each of the multiple servers is obtained from the base station to obtain multiple target process messages, wherein the target process message is used to indicate the process of connecting the corresponding server to the base station; a thread is created for each of the multiple target process messages to obtain multiple target threads, wherein the target thread is used to transmit the corresponding target process message to the corresponding server, and the server is used to connect to the base station according to the received target process message, that is, when a target connection request issued by the base station to request that multiple servers be connected to the base station is received , in response to the target connection request, the process message of each server in the multiple servers is obtained from the base station to obtain multiple target process messages. According to the target process message, the process of the corresponding server connecting to the base station can be determined. Finally, a thread is created for each target process message in the multiple target process messages to obtain multiple target threads, and the corresponding target process message is transmitted to the corresponding server according to the target thread. The server connects to the base station according to the received target process message. The above-mentioned multiple servers are connected to the base station at the same time through multiple target threads, which ensures that the processes of multiple servers connecting to the base station are independent of each other and do not interfere with each other, reduces the conflict problem of different servers connecting to the base station, and improves the connection efficiency between the base station and the server. The above-mentioned technical solution solves the problems of low connection efficiency between the base station and the server in the related technology, and achieves the technical effect of improving the connection efficiency between the base station and the server. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0041] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0042] Figure 1 It is a hardware environment diagram of a connection control method between a base station and a server according to an embodiment of the present application;

[0043] Figure 2 is a flow chart of a method for controlling connection between a base station and a server according to an embodiment of the present application;

[0044] Figure 3 is a schematic diagram of a process message acquisition between a base station and a server according to an embodiment of the present application;

[0045] Figure 4 is a flow chart of target process message generation according to an embodiment of the present application;

[0046] Figure 5 is a schematic diagram of a connection between a base station and a server according to an embodiment of the present application;

[0047] Figure 6 is a schematic diagram of a target transmission state according to an embodiment of the present application;

[0048] Figure 7 It is a structural block diagram of a connection control device between a base station and a server according to an embodiment of the present application. DETAILED DESCRIPTION

[0049] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

[0050] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0051] The method embodiments provided in the embodiments of the present application can be executed in a computer terminal, a device terminal or a similar computing device. Taking running on a computer terminal as an example, Figure 1 Schematic diagram of the hardware environment of a method for controlling the connection between a base station and a server according to an embodiment of the present application. Figure 1 As shown, the computer terminal may include one or more ( Figure 1Only one is shown in the figure) processor 102 (processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. In an exemplary embodiment, the computer terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above-mentioned computer terminal. Figure 1 More or fewer components as shown, or with Figure 1 Equivalent functions or comparisons shown Figure 1 A different configuration with more features is shown.

[0052] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the connection control method between the base station and the server in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0053] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of a computer terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0054] In this embodiment, a method for controlling the connection between a base station and a server is provided, which is applied to the above-mentioned computer terminal. Figure 2 is a flow chart of a method for controlling a connection between a base station and a server according to an embodiment of the present application. Figure 2 As shown, the process includes the following steps:

[0055] Step S202, receiving a target connection request sent by a base station, wherein the target connection request is used to request to connect multiple servers to the base station;

[0056] Step S204, in response to the target connection request, obtaining a process message of each of the multiple servers from the base station to obtain multiple target process messages, wherein the target process message is used to indicate a process of connecting the corresponding server to the base station;

[0057] Step S206, creating a thread for each of the multiple target process messages to obtain multiple target threads, wherein the target thread is used to transmit the corresponding target process message to the corresponding server, and the server is used to connect to the base station according to the received target process message.

[0058] Through the above steps, in the case of receiving a target connection request sent by the base station for requesting to connect multiple servers to the base station, respond to the target connection request, obtain the process message of each of the multiple servers from the base station, obtain multiple target process messages, and determine the process of the corresponding server connecting to the base station according to the target process message. Finally, create a thread for each of the multiple target process messages to obtain multiple target threads, and transmit the corresponding target process message to the corresponding server according to the target thread. The server connects to the base station according to the received target process message. The above-mentioned multiple servers are connected to the base station at the same time through multiple target threads, ensuring that the processes of multiple servers connecting to the base station are independent of each other and do not interfere with each other, reducing the conflict problem of different servers connecting to the base station, and improving the efficiency of the connection between the base station and the server. The above technical solution solves the problems of low connection efficiency between the base station and the server in the related technology, and achieves the technical effect of improving the connection efficiency between the base station and the server.

[0059] In the technical solution provided in the above step S202, a target connection request sent by a base station is received, wherein the target connection request is used to request to connect multiple servers to the base station.

[0060] Optionally, in this embodiment, the base station may include but is not limited to a macro base station, a micro base station, a pico base station, a femto base station, etc., wherein the connection control process between the base station and the server is described using the pico base station as the base station, and the type of base station is not limited.

[0061] In the technical solution provided in the above step S204, in response to the target connection request, a process message of each of the multiple servers is obtained from the base station to obtain multiple target process messages, wherein the target process message is used to indicate the process of the corresponding server connecting to the base station.

[0062] Optionally, in this embodiment, the base station can be connected to multiple servers. When multiple servers receive target connection requests, they can obtain their respective process messages from the base station to obtain multiple target process messages. The target process messages can indicate the process steps for the corresponding servers to connect to the base station.

[0063] In an exemplary embodiment, the process message of each of the multiple servers can be obtained from the base station in the following manner, but is not limited to: creating an oamClient object for each of the multiple servers to obtain multiple oamClient objects; controlling each of the multiple oamClient objects to obtain the configuration data of the corresponding server from the base station, and reading the historical connection status of the base station, wherein the configuration data includes installation parameters and connection parameters, the installation parameters are used to indicate the installation information of the corresponding server connecting to the base station, the connection parameters are used to indicate whether the base station currently initiates a connection, and the historical connection status is used to indicate the connection status of the base station before the last restart; and generating a process message corresponding to each server according to the configuration data and the historical connection status.

[0064] Optionally, in this embodiment, Figure 3 is a schematic diagram of a process message acquisition between a base station and a server according to an embodiment of the present application, such as Figure 3 As shown, taking the base station (pico base station) expected to connect to 4 servers (server 1 to server 4) as an example, first create an oamClient object for each server to obtain multiple oamClient objects (oamClient 1 to oamClient 4), and control each oamClient object to obtain the configuration data of the corresponding server from the base station. For example, taking server 1 connecting to the base station as an example, the steps for other servers to connect to the base station are similar. First, control oamClient 1 to obtain the configuration data of server 1 from the base station, and read the historical connection status of server 1 in the base station. The configuration data includes the installation parameters and connection parameters of server 1. The installation parameters are used to indicate the installation information of the corresponding server 1 connecting to the base station, and the connection parameters are used to indicate whether the base station currently initiates a connection. The historical connection status is used to indicate the connection status of the base station with server 1 before the last restart; the process message corresponding to server 1 is generated according to the configuration data and the historical connection status.

[0065] In an exemplary embodiment, a process message corresponding to each server can be generated according to the configuration data and the historical connection status in the following manner, but is not limited to: obtaining a reference process message for the server to connect to the base station, wherein the reference process message is used to indicate the connection process required for the server to initially connect to the base station; removing the connection process before the historical connection state in the reference process message to obtain a candidate process message; adding the configuration data to the candidate process message to obtain the target process message.

[0066] Optionally, in this embodiment, Figure 4 is a flow chart of target process message generation according to an embodiment of the present application, such as Figure 4 As shown, first, obtain a reference process message for the server to connect to the base station, wherein the reference process message can indicate the connection process required for the server to connect to the base station for the first time. For example, the reference process message can indicate that the server needs to go through the process from connection state 1 to connection state N when it connects to the base station for the first time, that is, the above-mentioned connection process, and the connection state between the server and the base station before the last restart of the base station can be determined from the historical connection state. When connecting again, the historical connection state can be skipped. For example, the historical connection state indicates that the connection state between the server and the base station was connection state 2 before the last restart. Then, the connection process of connection state 1 can no longer be executed when connecting again, and it can be directly continued from connection state 2. Therefore, the connection process (connection state 1) before the historical connection state in the reference process message (connection state 1 to connection state N) can be removed to obtain the candidate process message (connection state 2 to connection state N); finally, the configuration data is added to the candidate process message to obtain the target process message.

[0067] In the technical solution provided in the above step S206, a thread is created for each of the multiple target process messages to obtain multiple target threads, wherein the target thread is used to transmit the corresponding target process message to the corresponding server, and the server is used to connect to the base station according to the received target process message.

[0068] Optionally, in this embodiment, the target thread is used to transmit the corresponding target process message to the corresponding server, and the server is used to connect to the base station according to the received target process message. The base station processes different logics and communicates asynchronously with the same server in a multi-threaded manner, thereby achieving a technical effect of non-interference between servers and unified management. Using a multi-threaded approach, it is easy to schedule and improve concurrency. Concurrency can be conveniently and effectively achieved through threads. A process can create multiple threads to execute different parts of the same program. And creating a thread is faster than creating a process, and the overhead required is very small. It is conducive to giving full play to the functions of multiple processors. By creating a multi-threaded process (that is, a process can have two or more threads), each thread runs on one processor, thereby achieving the concurrency of the application program and allowing each processor to run fully.

[0069] In an exemplary embodiment, a thread can be created for each of the multiple target process messages to obtain multiple target threads in the following manner, but is not limited to: a httpclient object is created for each of the multiple target process messages to obtain multiple httpclient objects, wherein the httpclient objects correspond one-to-one to the servers; and each of the multiple httpclient objects is controlled to create a thread to obtain multiple target threads.

[0070] Optionally, in this embodiment, Figure 5 is a schematic diagram of a connection between a base station and a server according to an embodiment of the present application, such as Figure 5 As shown, the target process message corresponds to the server one by one, and an httpclient object is created for each target process message to obtain multiple httpclient objects (httpclient 1 to httpclient 4). The httpclient objects correspond to the servers one by one, and each of the httpclient objects is controlled to create a thread corresponding to the server.

[0071] Optionally, in this embodiment, if Figure 5As shown, taking the base station connecting to 4 servers as an example, the connection software starts the main process in the initialization phase, and keeps the state machine of the main process from closing through a cyclic timer task. It is expected to connect to 4 servers, so 4 oamClient objects are created by default. The specific number of oamClient objects can be consistent with the number of expected connected servers. Each oamClient object can obtain the installation parameters of the corresponding server, whether to initiate a connection, and other configuration information, read and inherit the connection status before the last restart. At this time, if the connection switch of the base station is turned on, that is, the base station currently initiates a connection, it is necessary to initiate the corresponding process according to the previous historical connection status of the base station. At this time, the target process message corresponding to the server is formed according to the existing configuration. When the corresponding target process message is formed, the message is sent through httpProxy (proxy server). If there is no corresponding httpclient object before, a new httpclient object needs to be created. The httpclient object can initialize the thread object through the corresponding pthread_mutex_init function in the initialization phase. Finally, when calling httpclient to send a message, the pthread_create function can be used to create a thread to process the message, and the callback function callback is used to process the message received by the thread. The received message is placed in the queue of the main process as a task for one-to-one response. In this process, oamClient and httpclient correspond one-to-one through id numbers (for example, oamClient 1 corresponds to httpclient 1), that is, each oamClient has an httpclient to send and receive messages, and multi-threading is used to avoid interference between messages and untimely processing.

[0072] Optionally, in this embodiment, when using an independent thread to send and receive messages, httpclient objects with different id numbers can be managed in httpProxy to send specified messages to the server, obtain the server's response, query whether a message is currently being sent, stop sending messages, and other operations.

[0073] In an exemplary embodiment, each of the multiple httpclient objects can be controlled to create a thread to obtain multiple target threads in the following manner, but is not limited to: controlling the httpclient object to call the pthread_mutex_init function to initialize the thread to obtain the initial thread; after the initialization thread is completed, controlling the httpclient object to call the pthread_create function to create the initial thread as the target thread.

[0074] Optionally, in this embodiment, for any httpclient object, a thread may be created by, but is not limited to, controlling the httpclient object to call a pthread_mutex_init function to initialize the thread, obtaining an initial thread, and then controlling the httpclient object to call a pthread_create function to create the initial thread as a target thread.

[0075] In an exemplary embodiment, after creating a thread for each of the multiple target process messages, the following methods may be included, but are not limited to, detecting the current state of the httpclient object corresponding to the server when it is detected that the base station sends target data to the corresponding server through the target thread; adding the target data to a transmission queue when the current state indicates that the httpclient object is in a target transmission state, wherein the target transmission state includes an idle state, a sending state, and a waiting state; and prohibiting the target data from being added to the transmission queue when the current state indicates that the httpclient object is not in the target transmission state.

[0076] Optionally, in this embodiment, Figure 6 is a schematic diagram of a target transmission state according to an embodiment of the present application, such as Figure 6 As shown, the Httpclient object defines five working states: IDLE, SENDING, WAITING, STOPPING, and STOPPED. The initialization phase is in the IDLE state. When there is a message to be sent, a thread is created and the state is changed to the SENDING state. After the message is sent to the server, the waiting phase for the response is in the WAITING state. After receiving the response, the state is changed to the IDLE state and waits for the next call. When httpProxy receives a forced stop or reset instruction from the maintenance management module, the httpclient object will enter the STOPPED state. In this state, no new messages will be sent, and the server will be waiting for the message being returned. At this time, it will enter the STOPPING state. When all messages are received and there are no pending tasks, it returns to the IDLE state.

[0077] Optionally, in this embodiment, the above-mentioned IDLE (idle state), SENDING (sending state), and WAITING (waiting state) belong to the target transmission state, that is, the current state indicates that the httpclient object is in the target transmission state, and the above-mentioned STOPPING (stopping) and STOPPED (stopped) belong to the non-target transmission state, that is, the current state indicates that the httpclient object is not in the target transmission state.

[0078] In an exemplary embodiment, after creating a thread for each of the multiple target process messages, the initial data to be transmitted from the base station to the target server can be obtained in the following manners, but is not limited to: obtaining the curl_easy_setopt function from the libcurl library to set the initial data to a target format to obtain target data, wherein the target format is a format that the corresponding target server allows to be recognized; parsing the target data through the httpclient object corresponding to the target server to obtain parsed data; and sending the parsed data to the target server through the thread corresponding to the target server.

[0079] Optionally, in this embodiment, if Figure 5 As shown, the Httpclient object can create an independent thread through the pthread_create function. When a message needs to be sent, the curl_easy_setopt function of the libcurl library is used to set the corresponding message format. The CURLOPT_WRITEDATA function and the CURLOPT_HEADERDATA function can be used as callback functions to obtain the server's response. The curl_easy_perform function is used to send the message. Finally, the message is parsed and returned to the httpclient object through httpProxy for use and corresponding processing operations.

[0080] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of each embodiment of the present application.

[0081] Figure 7is a structural block diagram of a connection control device between a base station and a server according to an embodiment of the present application; Figure 7 As shown, including:

[0082] The receiving module 702 is used to receive a target connection request sent by a base station, wherein the target connection request is used to request to connect multiple servers to the base station;

[0083] A first acquisition module 704 is used to respond to the target connection request, obtain a process message of each of the multiple servers from the base station, and obtain multiple target process messages, wherein the target process message is used to indicate a process of connecting the corresponding server to the base station;

[0084] The creation module 706 is used to create a thread for each target process message in the multiple target process messages to obtain multiple target threads, wherein the target thread is used to transmit the corresponding target process message to the corresponding server, and the server is used to connect to the base station according to the received target process message.

[0085] Through the above embodiment, in the case of receiving a target connection request sent by a base station for requesting to connect multiple servers to the base station, respond to the target connection request, obtain the process message of each of the multiple servers from the base station, obtain multiple target process messages, and determine the process of connecting the corresponding server to the base station according to the target process message. Finally, create a thread for each of the multiple target process messages to obtain multiple target threads, and transmit the corresponding target process message to the corresponding server according to the target thread. The server connects to the base station according to the received target process message. The above-mentioned multiple servers are connected to the base station at the same time through multiple target threads, ensuring that the processes of connecting multiple servers to the base station are independent of each other and do not interfere with each other, reducing the conflict problem of different servers connecting to the base station, and improving the efficiency of the connection between the base station and the server. The above technical solution solves the problems of low connection efficiency between the base station and the server in the related technology, and achieves the technical effect of improving the connection efficiency between the base station and the server.

[0086] In an exemplary embodiment, the creation module includes:

[0087] A first creation unit is used to create an httpclient object for each target flow message in the multiple target flow messages to obtain multiple httpclient objects, wherein the httpclient objects correspond to servers one by one;

[0088] The first control unit is used to control each of the multiple httpclient objects to create a thread to obtain multiple target threads.

[0089] In an exemplary embodiment, the first control unit is further configured to:

[0090] Control the httpclient object to call the pthread_mutex_init function to initialize the thread and obtain the initial thread;

[0091] After the initialization thread is completed, the httpclient object is controlled to call the pthread_create function to create the initial thread as the target thread.

[0092] In an exemplary embodiment, the first acquisition module includes:

[0093] A second creating unit is used to create an oamClient object for each of the multiple servers to obtain multiple oamClient objects;

[0094] a second control unit, configured to control each of the plurality of oamClient objects to obtain configuration data of a corresponding server from the base station, and read a historical connection state of the base station, wherein the configuration data includes installation parameters and connection parameters, the installation parameters are used to indicate installation information of the corresponding server connecting to the base station, the connection parameters are used to indicate whether the base station currently initiates a connection, and the historical connection state is used to indicate a connection state of the base station before the last restart;

[0095] A generating unit is used to generate a process message corresponding to each of the servers according to the configuration data and the historical connection status.

[0096] In an exemplary embodiment, the generating unit is further configured to:

[0097] Acquire a reference process message for the server to connect to the base station, wherein the reference process message is used to indicate a connection process required for the server to connect to the base station for the first time;

[0098] Removing the connection process before the historical connection state in the reference process message to obtain a candidate process message;

[0099] The configuration data is added to the candidate process message to obtain the target process message.

[0100] In an exemplary embodiment, the apparatus further comprises:

[0101] a detection module, configured to detect a current state of an httpclient object corresponding to the server when it is detected that the base station sends target data to the corresponding server through the target thread after creating a thread for each target flow message in the plurality of target flow messages;

[0102] An adding module, used for adding the target data to a transmission queue when the current state indicates that the httpclient object is in a target transmission state, wherein the target transmission state includes an idle state, a sending state and a waiting state;

[0103] The prohibition module is used to prohibit the target data from being added to the transmission queue when the current state indicates that the httpclient object is not in the target transmission state.

[0104] In an exemplary embodiment, after creating a thread for each of the plurality of target process messages, the apparatus further comprises:

[0105] A second acquisition module is used to acquire initial data sent from the base station to be transmitted to the target server;

[0106] A setting module, used to obtain the curl_easy_setopt function from the libcurl library to set the initial data to a target format, thereby obtaining target data, wherein the target format is a format that the corresponding target server allows to be recognized;

[0107] A parsing module, used for parsing the target data through the httpclient object corresponding to the target server to obtain parsed data;

[0108] A sending module is used to send the parsed data to the target server through a thread corresponding to the target server.

[0109] An embodiment of the present application further provides a storage medium, which includes a stored program, wherein the program executes any of the above methods when it is run.

[0110] Optionally, in this embodiment, the storage medium may be configured to store program codes for executing the following steps:

[0111] S1, receiving a target connection request sent by a base station, wherein the target connection request is used to request to connect multiple servers to the base station;

[0112] S2, in response to the target connection request, obtaining a process message of each of the multiple servers from the base station to obtain multiple target process messages, wherein the target process message is used to indicate a process of connecting the corresponding server to the base station;

[0113] S3, creating a thread for each of the multiple target process messages to obtain multiple target threads, wherein the target thread is used to transmit the corresponding target process message to the corresponding server, and the server is used to connect to the base station according to the received target process message.

[0114] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0115] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0116] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:

[0117] S1, receiving a target connection request sent by a base station, wherein the target connection request is used to request to connect multiple servers to the base station;

[0118] S2, in response to the target connection request, obtaining a process message of each of the multiple servers from the base station to obtain multiple target process messages, wherein the target process message is used to indicate a process of connecting the corresponding server to the base station;

[0119] S3, creating a thread for each of the multiple target process messages to obtain multiple target threads, wherein the target thread is used to transmit the corresponding target process message to the corresponding server, and the server is used to connect to the base station according to the received target process message.

[0120] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store program codes.

[0121] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.

[0122] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.

[0123] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A method for controlling a connection between a base station and a server, characterized in that: include: receiving a target connection request sent by a base station, wherein the target connection request is used to request to connect multiple servers to the base station; In response to the target connection request, obtaining a process message of each of the multiple servers from the base station to obtain multiple target process messages, wherein the target process message is used to indicate a process of connecting the corresponding server to the base station; A thread is created for each of the multiple target process messages to obtain multiple target threads, wherein the target thread is used to transmit the corresponding target process message to the corresponding server, and the server is used to connect to the base station according to the received target process message.

2. The method according to claim 1, characterized in that The step of creating a thread for each target process message in the multiple target process messages to obtain multiple target threads includes: Creating an httpclient object for each of the multiple target process messages to obtain multiple httpclient objects, wherein the httpclient objects correspond to the servers one by one; Each of the multiple httpclient objects is controlled to create a thread, thereby obtaining multiple target threads.

3. The method according to claim 2, characterized in that The controlling each of the plurality of the httpclient objects to create a thread to obtain the plurality of the target threads comprises: Control the httpclient object to call the pthread_mutex_init function to initialize the thread and obtain the initial thread; After the initialization thread is completed, the httpclient object is controlled to call the pthread_create function to create the initial thread as the target thread.

4. The method according to claim 1, characterized in that: The acquiring, from the base station, a process message of each server among the plurality of servers comprises: Creating an oamClient object for each of the multiple servers to obtain multiple oamClient objects; Controlling each of the multiple oamClient objects to obtain configuration data of a corresponding server from the base station, and read a historical connection status of the base station, wherein the configuration data includes installation parameters and connection parameters, the installation parameters are used to indicate installation information of the corresponding server connecting to the base station, the connection parameters are used to indicate whether the base station currently initiates a connection, and the historical connection status is used to indicate a connection status of the base station before the last restart; A process message corresponding to each of the servers is generated according to the configuration data and the historical connection status.

5. The method according to claim 4, characterized in that The generating a process message corresponding to each server according to the configuration data and the historical connection status includes: Acquire a reference process message for the server to connect to the base station, wherein the reference process message is used to indicate a connection process required for the server to connect to the base station for the first time; Removing the connection process before the historical connection state in the reference process message to obtain a candidate process message; The configuration data is added to the candidate process message to obtain the target process message.

6. The method according to any one of claims 1 to 5, characterized in that After creating a thread for each of the multiple target process messages, the method further includes: In the case where it is detected that the base station sends target data to the corresponding server through the target thread, detecting the current state of the httpclient object corresponding to the server; In the case where the current state indicates that the httpclient object is in a target transmission state, adding the target data to a transmission queue, wherein the target transmission state includes an idle state, a sending state, and a waiting state; When the current state indicates that the httpclient object is not in the target transmission state, adding the target data to the transmission queue is prohibited.

7. The method according to claim 6, characterized in that After creating a thread for each of the multiple target process messages, the method further includes: Acquire initial data sent from the base station to be transmitted to the target server; Obtain the curl_easy_setopt function from the libcurl library to set the initial data to a target format, thereby obtaining target data, wherein the target format is a format that the corresponding target server allows to be recognized; Parsing the target data through the httpclient object corresponding to the target server to obtain parsed data; The parsed data is sent to the target server through a thread corresponding to the target server.

8. A connection control device between a base station and a server, characterized in that: include: A receiving module, configured to receive a target connection request sent by a base station, wherein the target connection request is used to request to connect multiple servers to the base station; A first acquisition module, configured to respond to the target connection request, acquire a process message of each of the plurality of servers from the base station, and obtain a plurality of target process messages, wherein the target process message is used to indicate a process of connecting the corresponding server to the base station; A creation module is used to create a thread for each target process message in the multiple target process messages to obtain multiple target threads, wherein the target thread is used to transmit the corresponding target process message to the corresponding server, and the server is used to connect to the base station according to the received target process message.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program executes the method according to any one of claims 1 to 7 when executed.

10. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 7 through the computer program.