Cross-network communication method and device, electronic equipment, storage medium and computer program
By accessing the virtual LAN and using a bridge container for data forwarding, the problem of inability to communicate between different clients is solved, and cross-network communication is realized, so that the data on the client side can be subscribed by other clients.
Patent Information
- Application Number
- CN202411684576.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-22
- Publication Date
- 2025-04-08
AI Technical Summary
现有技术中,同一服务端通过广域网与多个客户端进行通信时,不同客户端之间无法相互发现或通信,导致数据无法被另一个客户端订阅。
By obtaining the bridge container information of the virtual LAN created by the server, the client can access the corresponding virtual LAN and send data to the target client side through the target bridge container to realize cross-network communication between different clients.
Communication between different clients on the same server is realized, so that the FastDDS application data on the client side can be subscribed by the FastDDS application of another client, solving the problem that the data cannot be subscribed by another client.
Smart Images

Figure CN119788460A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of communication technology, and in particular, relates to a cross-network communication method, device, electronic device, storage medium and computer program. Background Art
[0002] Generally, the same server communicates with multiple clients through a wide area network (WAN). Any client including the FastDDS application in the WAN accesses the server through the WAN.
[0003] However, different clients communicating with the same server through the same WAN can neither discover nor communicate with each other, resulting in the data sent by a client being unable to be subscribed to by another client. Summary of the invention
[0004] The present application aims to solve at least one of the technical problems existing in the prior art. To this end, the present application proposes a cross-network communication method to achieve communication between different clients communicating with the same server.
[0005] In a first aspect, the present application provides a cross-network communication method, applied to a client, the method comprising:
[0006] Get the bridge container information of each virtual LAN created by the server;
[0007] According to the network access requirements, access the corresponding one or more virtual LANs through one or more bridge containers;
[0008] The data of the FastDDS application on the client side is sent to the FastDDS application on the target client side through the target bridge container, and the data of the FastDDS application on the target client side is sent to the FastDDS application on the client side through the target bridge container; wherein the target client is a client that has been connected to the corresponding virtual LAN through the target bridge container.
[0009] According to the cross-network communication method of the present application, the client accesses the corresponding one or more virtual LANs through one or more bridge containers, and then sends the data of the FastDDS application on the client side to the FastDDS application on the target client side through the target bridge container, and sends the data of the FastDDS application on the target client side to the FastDDS application on the client side through the target bridge container, so as to realize communication between the client and another client, so that the data of the FastDDS application on the client side can be subscribed by the FastDDS application of another client.
[0010] According to an embodiment of the present application, accessing a corresponding virtual local area network through a bridge container includes:
[0011] Based on the bridge container information, establish a TCP connection with the corresponding bridge container and create a virtual network card;
[0012] Based on the TCP connection, obtain the target IP address issued by the bridge container of the corresponding virtual LAN, set the IP address of the virtual network card to the target IP address to access the corresponding virtual LAN.
[0013] According to an embodiment of the present application, the method further includes: when the client exits the virtual local area network, deleting the corresponding virtual network card, and disconnecting the TCP connection with the bridge container of the virtual local area network to be exited.
[0014] In a second aspect, the present application provides a cross-network communication system, the system comprising: a server and multiple clients, the clients being deployed in different hosts;
[0015] The server is used to create bridge containers for multiple virtual LANs;
[0016] The client is used to obtain the bridge container information of each virtual local area network created by the server, and access the corresponding one or more virtual local area networks through one or more bridge containers according to the network access requirements; and send the data of the FastDDS application on the client side to the target bridge container; and send the data of the target client side FastDDS application forwarded by the target bridge container to the FastDDS application on the client side;
[0017] The bridge container is used to forward data between clients in this virtual LAN.
[0018] According to the cross-network communication system of the present application, the client accesses the corresponding one or more virtual LANs through one or more bridge containers, and then sends the data of the FastDDS application on the client side to the FastDDS application on the target client side through the target bridge container, and sends the data of the FastDDS application on the target client side to the FastDDS application on the client side through the target bridge container, so as to realize communication between the client and another client, so that the data of the FastDDS application on the client side can be subscribed by the FastDDS application of another client.
[0019] According to an embodiment of the present application, the server is specifically used to obtain CIDR information of each virtual local area network, create a corresponding virtual local area network, and start a bridge container corresponding to each virtual local area network.
[0020] According to an embodiment of the present application, the bridge container is located on the server side, and the bridge container is used to provide TCP service and DHCP service for the client.
[0021] According to one embodiment of the present application, the client is specifically used to establish a TCP connection with the corresponding bridge container based on the bridge container information, and create a virtual network card; based on the TCP connection, obtain the target IP address issued by the bridge container of the corresponding virtual local area network, and set the IP address of the virtual network card as the target IP address to access the corresponding virtual local area network.
[0022] According to one embodiment of the present application, the client is also used to delete the corresponding virtual network card when exiting the virtual local area network, and disconnect the TCP connection with the bridge container of the virtual local area network to be exited.
[0023] In a third aspect, the present application provides a cross-network communication device, the device comprising:
[0024] The acquisition module is used to obtain the bridge container information of each virtual local area network created by the server;
[0025] An access module is used to access one or more corresponding virtual local area networks through one or more bridge containers according to network access requirements;
[0026] A sending module is used to send the data of the FastDDS application on the client side to the FastDDS application on the target client side through the target bridge container, and to send the data of the FastDDS application on the target client side to the FastDDS application on the client side through the target bridge container; wherein the target client is a client that has been connected to the corresponding virtual local area network through the target bridge container.
[0027] According to the cross-network communication device of the present application, the client accesses the corresponding one or more virtual local area networks through one or more bridge containers, and then sends the data of the FastDDS application on the client side to the target client side FastDDS application through the target bridge container, and sends the data of the target client side FastDDS application to the FastDDS application on the client side through the target bridge container, so as to realize communication between the client and another client, so that the data of the FastDDS application on the client side can be subscribed by the FastDDS application of another client.
[0028] In a fourth aspect, the present application provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the cross-network communication method as described in the first aspect above is implemented.
[0029] In a fifth aspect, the present application provides a non-transitory computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the cross-network communication method as described in the first aspect above is implemented.
[0030] In a sixth aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the cross-network communication method as described in the first aspect above.
[0031] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0033] Figure 1 It is a structural diagram of a wide area network communication structure provided in an embodiment of the present application;
[0034] Figure 2 It is a structural diagram of the communication structure of the cross-network communication method provided in an embodiment of the present application;
[0035] Figure 3 It is a flowchart of the cross-network communication method provided in an embodiment of the present application;
[0036] Figure 4 It is a flow chart of the inter-network communication system provided by an embodiment of the present application;
[0037] Figure 5 is a schematic diagram of the structure of the cross-network communication device provided in an embodiment of the present application;
[0038] Figure 6 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0039] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0040] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0041] In related technologies, such as Figure 1 As shown, the IP address of the network card eth0 of the public network device is 222.222.222.222 / 24, the IP address of the network card eth1 of the first intranet device based on FastDDS is 192.168.1.222 / 24, the IP address of the network card eth2 of the second intranet device based on FastDDS is 192.168.2.222 / 24, and the IP address of the network card eth3 of the third intranet device based on FastDDS is 192.168.3.222 / 24. The first intranet device, the second intranet device, and the third intranet device communicate with the public network device based on FastDDS respectively.
[0042] Among them, FastDDS is an open source implementation of the DDS protocol, and DDS is a distributed real-time communication middleware protocol that uses a publish / subscribe architecture. FastDDS supports TCP transmission and can be used for cross-WAN communication, but the cross-WAN communication method based on TCP transmission is not applicable to devices based on DDS, and this method does not support mutual discovery based on UDP broadcast. Therefore, the first intranet device, the second intranet device, and the third intranet device cannot communicate with each other. For example, the first intranet device and the second intranet device cannot communicate with each other.
[0043] The following, in conjunction with the accompanying drawings, describes in detail the cross-network communication method, cross-network communication device, electronic device and readable storage medium provided in the embodiments of the present application through specific embodiments and their application scenarios.
[0044] Among them, the cross-network communication method can be applied to a terminal, and can be specifically executed by hardware or software in the terminal.
[0045] The terminal includes, but is not limited to, a portable communication device such as a mobile phone or tablet computer with a touch-sensitive surface (e.g., a touch screen display and / or a touch pad). It should also be understood that in some embodiments, the terminal may not be a portable communication device, but a desktop computer with a touch-sensitive surface (e.g., a touch screen display and / or a touch pad).
[0046] In the following various embodiments, a terminal including a display and a touch-sensitive surface is described. However, it should be understood that the terminal may include one or more other physical user interface devices such as a physical keyboard, a mouse and a joystick.
[0047] The present application embodiment provides a cross-network communication method. The method may include the following steps:
[0048] Step 1: Deploy the server program on the public network device and the client program on the intranet device. For example, deploy the client program on the first intranet device, the second intranet device and the third intranet device, respectively, which are the client, the second client and the third client. The server program has the function of creating a bridge container for a virtual LAN. The public network device can be a server, and the intranet device can be a device connected to the Internet or a local network, such as a host. Both the client program and the server program can be FastDDS applications.
[0049] Step 2: The server program on the public network device creates a bridge container for each virtual local area network, such as creating a bridge container for the first virtual local area network and a bridge container for the second virtual local area network. The bridge container of each virtual local area network has the function of being a TCP server and a DHCP server. The virtual local area network can accept access from multiple clients, such as the client and the second client accessing the first virtual local area network, and the client and the third client accessing the second virtual local area network.
[0050] Step 3: Each intranet device requests the public network device to obtain the bridge container information of the bridge containers of each virtual LAN that has been created through the client program on the intranet device. Taking the first intranet device as an example, the client on the first device requests the public network device to obtain the bridge container information of the bridge containers of each virtual LAN that has been created.
[0051] Step 4: The public network device sends the bridge container information of each created virtual LAN bridge container to the client through the server program.
[0052] Step 5: The client selects a virtual LAN from among the virtual LANs, such as the first virtual LAN, based on the bridge container information of the bridge container of each virtual LAN, and then establishes a TCP connection with the bridge container of the selected virtual LAN, such as establishing a TCP connection between the client and the bridge container of the first virtual LAN. The client also creates a virtual network card of the client, such as creating virtual network cards tap0 and tap1 of the client, creating virtual network card tap2 of the client by the second client, and creating virtual network card tap3 of the third client by the third client.
[0053] Step 6: The public network device sends an IP address to the client through a server program based on a TCP connection between the client and the server. For example, the public network device sends an IP address to the client through a server program based on a TCP connection between the client and the server.
[0054] Step 7: The client obtains an IP address based on a TCP connection, and sets the IP address as the IP address of the client's virtual network card to enable the client to access the virtual LAN. For example, the client obtains an IP address based on a TCP connection, and sets the IP address as the IP address of the client's virtual network card to enable the client to access the first virtual LAN, and the client obtains an IP address based on a TCP connection, and sets the IP address as the IP address of the client's virtual network card to enable the client to access the second virtual LAN.
[0055] Step 8: The client sends the first communication data to the bridge container of the first virtual local area network.
[0056] Step nine: The bridge container of the first virtual local area network sends the first communication data to the second client that has accessed the first virtual local area network.
[0057] Step 10: The bridge container of the first virtual local area network receives the second communication data sent by the second client, and sends the second communication data to the client.
[0058] In some embodiments, Figure 2 The communication structure of the cross-network communication method is shown, wherein the virtual local area network can accept access from multiple clients, for example, the client and the second client access the first virtual local area network, and the client and the third client access the second virtual local area network. The client can create multiple virtual network cards to access multiple virtual local area networks, for example, the client creates virtual network card tap0 and virtual network card tap1, accesses the first virtual local area network through the virtual network card tap0, and communicates with the second client who also joins the first virtual local area network through the first virtual local area network; accesses the second virtual local area network through the virtual network card tap1, and communicates with the third client who also joins the third virtual local area network through the second virtual local area network.
[0059] In some embodiments, Figure 2In the communication structure of the cross-network communication method shown, during the communication between the client and the second client, the first communication data sent by the client is sent to the bridge container of the first virtual local area network via the network card eth1 of the first intranet device and the network card eth0 of the public network device in sequence, and then the bridge container of the first virtual local area network sends the first communication data to the second client via the network card eth0 of the public network device and the network card eth2 of the second intranet device in sequence. In this way, the client based on FastDDS and the second client based on FastDDS can communicate with each other through the first virtual local area network. In the process of communication between the second client and the third client, the second communication data sent by the second client is sent to the bridge container of the second virtual local area network via the network card eth2 of the second intranet device and the network card eth0 of the public network device in sequence, and then the bridge container of the second virtual local area network sends the second communication data to the third client via the network card eth0 of the public network device and the network card eth3 of the third intranet device in sequence. In this way, the second client based on FastDDS and the third client based on FastDDS can communicate with each other through the first virtual local area network.
[0060] The cross-network communication method provided in the embodiment of the present application may be executed by an electronic device or a functional module or functional entity in the electronic device that can implement the cross-network communication method. The electronic devices mentioned in the embodiment of the present application include but are not limited to mobile phones, tablet computers, computers, cameras, and wearable devices. The cross-network communication method provided in the embodiment of the present application is described below using an electronic device as an example of an execution subject.
[0061] like Figure 3 As shown, the cross-network communication method includes: step 310, step 320 and step 330.
[0062] Step 310: Obtain the bridge container information of each virtual local area network created by the server.
[0063] In actual execution, the client may receive the bridge container information of the bridge containers of each virtual local area network created by the server sent by the server. The client may be a first intranet device on which a client program is deployed based on virtual server technology, and the server may be a public network device on which a server program is deployed based on virtual server technology, and the virtual server technology may be HTTP technology. The first intranet device and the public network device may communicate based on a wide area network.
[0064] In actual implementation, the server can be used to create one or more virtual local area network bridge containers, and generate bridge container information of each virtual local area network bridge container that has been created. The bridge container information of each virtual local area network bridge container that has been created can include bridge container information of multiple virtual local area network bridge containers, and the bridge container information can include at least one of the bridge container IP address or port information of each virtual local area network. The client can receive the bridge container information of each virtual local area network bridge container that has been created by the server from the server; the client can also first send a request to the server for obtaining the bridge container information of each virtual local area network bridge container that has been created, and then receive the bridge container information of each virtual local area network bridge container that has been created by the server from the server.
[0065] Step 320: Access the corresponding one or more virtual local area networks through one or more bridge containers according to the network access requirements.
[0066] In actual implementation, according to the network access requirements, a virtual LAN corresponding to the bridge container can be accessed through a bridge container, or a virtual LAN corresponding to each of the multiple bridge containers can be accessed through each of the multiple bridge containers to achieve access to multiple virtual LANs.
[0067] In actual execution, after the client receives the bridge container information of the bridge containers of each virtual local area network created by the server and sent by the server, the client can select the virtual local area network to be accessed from the bridge containers of each virtual local area network. The virtual local area network selected by the client can be any one of the virtual local area networks that have been created, or any multiple of the virtual local area networks that have been created, such as the first virtual local area network, such as the first virtual local area network and the second virtual local area network, and based on the bridge container information of the bridge container of the selected virtual local area network, access the selected virtual local area network, such as access the first virtual local area network based on the bridge container information of the bridge container of the first virtual local area network, such as access the first virtual local area network based on the bridge container information of the bridge container of the first virtual local area network, and access the second virtual local area network based on the bridge container information of the bridge container of the second virtual local area network.
[0068] In actual execution, the client can first establish a TCP connection with one or more virtual LAN bridge containers based on the bridge container information of the bridge containers of one or more virtual LANs, then create a virtual network card, and obtain the target IP address issued by the bridge container of one or more virtual LANs based on the TCP connection, and set the IP address of the virtual network card as the target IP address to access one or more virtual LANs.
[0069] In actual implementation, after the client accesses one or more virtual local area networks, the client may exit the virtual local area network that has been accessed to terminate the communication with the client accessing the virtual local area network.
[0070] Step 330: Send the data of the FastDDS application on the client side to the FastDDS application on the target client side through the target bridge container, and send the data of the FastDDS application on the target client side to the FastDDS application on the client side through the target bridge container; wherein the target client is a client that has been connected to the corresponding virtual LAN through the target bridge container.
[0071] In actual implementation, the target client may be any one of the clients connected to the same or multiple virtual local area networks as the client, or may be any multiple clients connected to the same or multiple virtual local area networks as the client.
[0072] In actual execution, after the client accesses the virtual LAN, the client can communicate with all clients other than the client that are also connected to the virtual LAN based on the bridge container of the virtual LAN. For example, the client can communicate with the target client that is also connected to the first virtual LAN based on the bridge container of the first virtual LAN. Specifically, the client can send the data of the FastDDS application on the client side to the bridge container of the first virtual LAN, so that the bridge container of the first virtual LAN forwards the data of the FastDDS application on the client side to all clients other than the client that are connected to the first virtual LAN; the client can receive the target data sent by the bridge container of the first virtual LAN, and the target data can be the data of the FastDDS application on the client side of any client other than the client that is connected to the first virtual LAN.
[0073] In some embodiments, the client can send data of the FastDDS application on the client side to the bridge container of the first virtual LAN, so that the bridge container of the first virtual LAN forwards the data of the FastDDS application on the client side to the first target client that is also connected to the first virtual LAN; and the client can send data of the FastDDS application on the client side to the bridge container of the second virtual LAN, so that the bridge container of the second virtual LAN forwards the data of the FastDDS application on the client side to the second target client that is also connected to the second virtual LAN.
[0074] In actual execution, based on the ShapesDemo of the FastDDS application, through the first intranet device where the client is located, the second intranet device where the target client is located, and the public network device where the server is located, it can be verified whether the client is connected to the virtual LAN, and communicate with the target client through the virtual LAN. Specifically, the client publishes Square based on the FastDDS application. If the target client successfully subscribes to Square based on the FastDDS application, it is determined that the client is connected to the virtual LAN, and communicates with the target client through the virtual LAN.
[0075] According to the cross-network communication method of the present application, the client accesses the corresponding one or more virtual LANs through one or more bridge containers, and then sends the data of the FastDDS application on the client side to the FastDDS application on the target client side through the target bridge container, and sends the data of the FastDDS application on the target client side to the FastDDS application on the client side through the target bridge container, so as to realize communication between the client and another client, so that the data of the FastDDS application on the client side can be subscribed by the FastDDS application of another client.
[0076] In some embodiments, accessing a corresponding virtual local area network through a bridge container may include:
[0077] Based on the bridge container information, establish a TCP connection with the corresponding bridge container and create a virtual network card;
[0078] Based on the TCP connection, obtain the target IP address issued by the bridge container of the corresponding virtual LAN, set the IP address of the virtual network card to the target IP address to access the corresponding virtual LAN.
[0079] In actual execution, the client may establish a TCP connection with the bridge container of the first virtual local area network based on the bridge container information of the bridge container of the first virtual local area network. The bridge container information of the bridge container of the first virtual local area network may include at least one of the IP address and port information of the bridge container of the first virtual local area network, and the client may establish a TCP connection with the bridge container of the first virtual local area network based on the IP address and / or port information of the bridge container of the bridge container of the first virtual local area network.
[0080] In actual execution, the client can establish a TCP connection with the bridge container of the first virtual local area network. The bridge container of the first virtual local area network can be located on the server side and have the function of a DHCP server to allocate IP addresses. Based on the TCP connection, the client can obtain the target IP address issued by the bridge container of the first virtual local area network, set the IP address of the created virtual network card as the target IP address, and access the first virtual local area network.
[0081] According to the cross-network communication method of the embodiment of the present application, a client communicating with a server based on FastDDS establishes a TCP connection with a corresponding bridge container based on the received bridge container information of the bridge container of the virtual LAN created by the server, so as to obtain the target IP address issued by the bridge container of the corresponding virtual LAN as the IP address of the virtual network card through the TCP connection, so as to access the corresponding virtual LAN, and then communicate with the target client that is also connected to the first virtual LAN based on the bridge container of the corresponding virtual LAN, so as to solve the problem that different clients communicating with the same server cannot communicate with each other.
[0082] In some embodiments, after obtaining the target IP address sent by the bridge container of the first virtual local area network based on the TCP connection and setting the IP address of the virtual network card as the target IP address, the cross-network communication method further includes:
[0083] When the client exits the virtual LAN, it deletes the corresponding virtual network card and disconnects the TCP connection with the bridge container of the virtual LAN to be exited.
[0084] In actual execution, the virtual local area network to be exited may be any one or more virtual local area networks that the client has accessed.
[0085] In actual execution, after the client obtains the target IP address issued by the bridge container of the first virtual local area network based on the TCP connection and sets the IP address of the virtual network card as the target IP address to access the first virtual local area network, the client can exit the first virtual local area network. Specifically, the client can delete the virtual network card created by the client and disconnect the TCP connection with the bridge container of the first virtual local area network to exit the first virtual local area network, wherein the virtual network card deleted by the client can be the virtual network card that sets the target IP address assigned by the bridge container of the first virtual local area network as the IP address.
[0086] According to the cross-network communication method of the embodiment of the present application, after joining the first virtual LAN, the client deletes the virtual network card and disconnects the TCP connection to exit the first virtual LAN, thereby enabling the client to freely access or exit the first virtual LAN.
[0087] An embodiment of the present application also provides an inter-network communication system.
[0088] like Figure 4 As shown, the cross-network communication system 400 includes: a server 410, N clients 42i (N is a positive integer greater than 0, i is a positive integer greater than 0 and less than or equal to N) and a bridge container 430. The server 410 is used to create a bridge container for multiple virtual local area networks; the client 42i is used to obtain the bridge container information of each virtual local area network created by the server, and access the corresponding one or more virtual local area networks through one or more bridge containers according to the network access requirements; and send the data of the FastDDS application on the client side to the target bridge container; and send the data of the target client side FastDDS application forwarded by the target bridge container to the FastDDS application on the client side;
[0089] The bridge container 430 is used to forward data between clients in the virtual local area network.
[0090] In actual implementation, the client 42i may be deployed in different hosts.
[0091] In actual implementation, the server can first create multiple virtual LAN bridge containers to achieve the creation of multiple virtual LANs, where the bridge container is used to forward data and dynamically allocate IP addresses to clients accessing the virtual LAN. Specifically, the server can access the IP address of the server on the public network device where it is located, and enter the virtual LAN CIDR to create a virtual LAN. After creating multiple virtual LANs, the server sends the bridge container information of the bridge containers of each virtual LAN created by the server to the client.
[0092] In some embodiments, the server may obtain CIDR information of each virtual local area network, create a corresponding virtual local area network, and start a bridge container corresponding to each virtual local area network to create multiple virtual local area networks.
[0093] In actual execution, after receiving the bridge container information of the bridge containers of each virtual local area network created by the server from the server, the client can select the virtual local area network to be accessed from the bridge containers of each virtual local area network. The virtual local area network selected by the client can be any one of the virtual local area networks that have been created, or any multiple of the virtual local area networks that have been created, such as the first virtual local area network, such as the first virtual local area network and the second virtual local area network, and based on the bridge container information of the bridge container of the selected virtual local area network, access the selected virtual local area network, such as access the first virtual local area network based on the bridge container information of the bridge container of the first virtual local area network, such as access the first virtual local area network based on the bridge container information of the bridge container of the first virtual local area network, and access the second virtual local area network based on the bridge container information of the bridge container of the second virtual local area network.
[0094] In actual execution, the client can first establish a TCP connection with one or more virtual LAN bridge containers based on the bridge container information of the bridge containers of one or more virtual LANs, then create a virtual network card, and obtain the target IP address issued by the bridge container of one or more virtual LANs based on the TCP connection, and set the IP address of the virtual network card as the target IP address to access one or more virtual LANs.
[0095] In some embodiments, the bridge container is located on the server side, and the bridge container is used to provide TCP service and DHCP service for the client.
[0096] In actual execution, after the client establishes a TCP connection with the bridge container, the bridge container sends the target IP address to the client through the TCP connection based on the DHCP service.
[0097] In actual implementation, after the client accesses one or more virtual local area networks, the client may exit the virtual local area network that has been accessed to terminate the communication with the client accessing the virtual local area network.
[0098] In actual implementation, the target client may be any one of the clients connected to the same or multiple virtual local area networks as the client, or may be any multiple clients connected to the same or multiple virtual local area networks as the client.
[0099] In some embodiments, the client can send data of the FastDDS application on the client side to the bridge container of the first virtual LAN, and the bridge container of the first virtual LAN forwards the data of the FastDDS application on the client side to the first target client that is also connected to the first virtual LAN; and the client can send data of the FastDDS application on the client side to the bridge container of the second virtual LAN, so that the bridge container of the second virtual LAN forwards the data of the FastDDS application on the client side to the second target client that is also connected to the second virtual LAN.
[0100] According to the cross-network communication system of the embodiment of the present application, the client accesses the corresponding one or more virtual LANs through one or more bridge containers, and then sends the data of the FastDDS application on the client side to the FastDDS application on the target client side through the target bridge container, and sends the data of the FastDDS application on the target client side to the FastDDS application on the client side through the target bridge container, so as to realize communication between the client and another client, so that the data of the FastDDS application on the client side can be subscribed by the FastDDS application of another client.
[0101] In some embodiments, the client is specifically used to establish a TCP connection with the corresponding bridge container based on the bridge container information and create a virtual network card; based on the TCP connection, obtain the target IP address issued by the bridge container of the corresponding virtual local area network, set the IP address of the virtual network card as the target IP address to access the corresponding virtual local area network.
[0102] In actual execution, the client may establish a TCP connection with the bridge container of the first virtual local area network based on the bridge container information of the bridge container of the first virtual local area network. The bridge container information of the bridge container of the first virtual local area network may include at least one of the IP address and port information of the bridge container of the first virtual local area network, and the client may establish a TCP connection with the bridge container of the first virtual local area network based on the IP address and / or port information of the bridge container of the bridge container of the first virtual local area network.
[0103] In actual execution, the client can establish a TCP connection with the bridge container of the first virtual local area network. The bridge container of the first virtual local area network can be located on the server side and have the function of a DHCP server to allocate IP addresses. Based on the TCP connection, the client can obtain the target IP address issued by the bridge container of the first virtual local area network, set the IP address of the created virtual network card as the target IP address, and access the first virtual local area network.
[0104] According to the cross-network communication system of the embodiment of the present application, a client communicating with a server based on FastDDS establishes a TCP connection with the bridge container of the first virtual LAN based on the bridge container information of the bridge container of the first virtual LAN created by the server, so as to obtain the target IP address issued by the bridge container of the first virtual LAN as the IP address of the virtual network card through the TCP connection, so as to access the first virtual LAN, and then communicate with the target client that is also connected to the first virtual LAN based on the bridge container of the first virtual LAN, so as to solve the problem that different clients communicating with the same server cannot communicate with each other.
[0105] According to one embodiment of the present application, the client is also used to delete the corresponding virtual network card when exiting the virtual local area network, and disconnect the TCP connection with the bridge container of the virtual local area network to be exited.
[0106] In actual execution, the virtual local area network to be exited may be any one or more virtual local area networks that the client has accessed.
[0107] In actual execution, the client obtains the target IP address issued by the bridge container of the first virtual local area network based on the TCP connection, sets the IP address of the virtual network card as the target IP address to access the first virtual local area network, and then the client can exit the first virtual local area network. Specifically, the client can delete the virtual network card created by the client, disconnect the TCP connection with the bridge container of the first virtual local area network, and exit the first virtual local area network, wherein the virtual network card deleted by the client can be the virtual network card that sets the target IP address assigned by the bridge container of the first virtual local area network as the IP address.
[0108] According to the cross-network communication system of the embodiment of the present application, after joining the first virtual LAN, the client deletes the virtual network card and disconnects the TCP connection to exit the first virtual LAN, thereby enabling the client to freely access or exit the first virtual LAN.
[0109] The cross-network communication method provided in the embodiment of the present application can be executed by a cross-network communication device. In the embodiment of the present application, the cross-network communication method is executed by a cross-network communication device as an example to illustrate that the embodiment of the present application provides a cross-network communication device.
[0110] An embodiment of the present application also provides a cross-network communication device.
[0111] like Figure 5 As shown, the inter-network communication device 500 communicates with the server based on, and the inter-network communication device 500 includes: an acquisition module 510, an access module 520 and a sending module 530.
[0112] The acquisition module 510 is used to acquire the bridge container information of each virtual local area network created by the server;
[0113] An access module 520 is used to access one or more corresponding virtual local area networks through one or more bridge containers according to network access requirements;
[0114] The sending module 530 is used to send the data of the FastDDS application on the client side to the FastDDS application on the target client side through the target bridge container, and to send the data of the FastDDS application on the target client side to the FastDDS application on the client side through the target bridge container; wherein the target client is a client that has been connected to the corresponding virtual local area network through the target bridge container.
[0115] According to the cross-network communication device of the embodiment of the present application, the client accesses the corresponding one or more virtual local area networks through one or more bridge containers, and then sends the data of the FastDDS application on the client side to the FastDDS application on the target client side through the target bridge container, and sends the data of the FastDDS application on the target client side to the FastDDS application on the client side through the target bridge container, so as to realize communication between the client and another client, so that the data of the FastDDS application on the client side can be subscribed by the FastDDS application of another client.
[0116] In some embodiments, the access module 520 includes:
[0117] An establishing unit, used to establish a TCP connection with a corresponding bridge container based on the bridge container information, and create a virtual network card;
[0118] The setting unit is used to obtain the target IP address sent by the bridge container of the corresponding virtual local area network based on the TCP connection, and set the IP address of the virtual network card as the target IP address to access the corresponding virtual local area network.
[0119] In some embodiments, the cross-network communication device 500 further includes:
[0120] The deletion module is used for deleting the corresponding virtual network card and disconnecting the TCP connection with the bridge container of the virtual local area network to be exited when the client exits the virtual local area network.
[0121] The cross-network communication device in the embodiment of the present application can be an electronic device or a component in the electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices other than a terminal. Exemplarily, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (augmented reality, AR) / virtual reality (virtual reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc. It can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0122] The cross-network communication device in the embodiment of the present application may be a device having an operating system. The operating system may be a Microsoft (Windows) operating system, an Android (Android) operating system, an IOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0123] The cross-network communication device provided in the embodiment of the present application can achieve Figure 3 To avoid repetition, the various processes implemented by the method embodiment are not described here.
[0124] In some embodiments, Figure 6 As shown, an embodiment of the present application also provides an electronic device 600, including a processor 601, a memory 602, and a computer program stored in the memory 602 and executable on the processor 601. When the program is executed by the processor 601, each process of the above-mentioned cross-network communication method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0125] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.
[0126] An embodiment of the present application also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the above-mentioned cross-network communication method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0127] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.
[0128] An embodiment of the present application also provides a computer program product, including a computer program, which implements the above-mentioned cross-network communication method when executed by a processor.
[0129] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.
[0130] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned cross-network communication method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0131] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0132] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0133] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods 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 computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0134] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
[0135] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials, or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0136] Although the embodiments of the present application have been shown and described, those skilled in the art will appreciate that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present application, and that the scope of the present application is defined by the claims and their equivalents.
Claims
1. A cross-network communication method, characterized in that: Applied to a client, the method comprises: Get the bridge container information of each virtual LAN created by the server; According to the network access requirements, access the corresponding one or more virtual LANs through one or more bridge containers; The data of the FastDDS application on the client side is sent to the FastDDS application on the target client side through the target bridge container, and the data of the FastDDS application on the target client side is sent to the FastDDS application on the client side through the target bridge container; wherein the target client is a client that has been connected to the corresponding virtual local area network through the target bridge container.
2. The cross-network communication method according to claim 1, characterized in that: Access the corresponding virtual LAN through the bridge container, including: Based on the bridge container information, establish a TCP connection with the corresponding bridge container and create a virtual network card; Based on the TCP connection, a target IP address sent by a bridge container of the corresponding virtual local area network is obtained, and the IP address of the virtual network card is set to the target IP address to access the corresponding virtual local area network.
3. The cross-network communication method according to claim 2, characterized in that: The method further includes: when the client exits the virtual local area network, deleting the corresponding virtual network card, and disconnecting the TCP connection with the bridge container of the virtual local area network to be exited.
4. A cross-network communication system, characterized in that: include: A server and multiple clients, wherein the clients are deployed in different hosts; The server is used to create bridge containers of multiple virtual local area networks; The client is used to obtain the bridge container information of each virtual local area network created by the server, and access the corresponding one or more virtual local area networks through one or more bridge containers according to the network access requirements; and send the data of the FastDDS application on the client side to the target bridge container; and send the received data of the target client side FastDDS application forwarded by the target bridge container to the FastDDS application on the client side; The bridge container is used to forward data between clients in the virtual local area network.
5. The inter-network communication system according to claim 4, characterized in that: The server is specifically used to obtain CIDR information of each virtual local area network, create the corresponding virtual local area network, and start the bridge container corresponding to each virtual local area network.
6. The inter-network communication system according to claim 4, characterized in that: The bridge container is located at the server side, and the bridge container is used to provide TCP service and DHCP service for the client.
7. The inter-network communication system according to claim 4, characterized in that: The client is specifically used to establish a TCP connection with the corresponding bridge container based on the bridge container information, and create a virtual network card; based on the TCP connection, obtain the target IP address issued by the bridge container of the corresponding virtual local area network, and set the IP address of the virtual network card to the target IP address to access the corresponding virtual local area network.
8. The inter-network communication system according to claim 4, characterized in that: The client is also used to delete the corresponding virtual network card and disconnect the TCP connection with the bridge container of the virtual local area network to be exited when exiting the virtual local area network.
9. A cross-network communication device, characterized in that: The device comprises: The acquisition module is used to obtain the bridge container information of each virtual local area network created by the server; An access module is used to access one or more corresponding virtual local area networks through one or more bridge containers according to network access requirements; A sending module is used to send the data of the FastDDS application on the client side to the FastDDS application on the target client side through the target bridge container, and to send the data of the FastDDS application on the target client side to the FastDDS application on the client side through the target bridge container; wherein the target client is a client that has been connected to the corresponding virtual local area network through the target bridge container.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the cross-network communication method as described in any one of claims 1-3 is implemented.
11. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the cross-network communication method as described in any one of claims 1 to 3 is implemented.
12. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the cross-network communication method according to any one of claims 1 to 3 is implemented.