Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the invention. It will be apparent, however, to one skilled in the art that the present invention may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present invention with unnecessary detail.
In order to explain the technical means of the present invention, the following description will be given by way of specific examples.
Fig. 1 shows a schematic networking structure diagram of an IPTV system according to an embodiment of the present invention. For convenience of explanation, only the portions related to the present embodiment are shown. Referring to fig. 1, a networking structure of an IPTV system includes a first networker and a first device deployed in an IPTV private network environment, a second networker and a second device deployed in a developer network environment, and a scheduler deployed in a public network environment; the first network component is connected with the first device through an IPTV private network, the second network component is connected with the second device through a developer network, and the first network component and the second network component are respectively in communication connection with the dispatcher.
Optionally, the scheduler is a scheduling server deployed in an Internet public network environment, and has a public network IP, a data transfer capability, and a configuration information issuing capability; the first network device and the second network device support TCP/IP protocol micro electronic equipment, and the first network device and the second network device have direct connection communication capability after being connected with the scheduler.
Optionally, the Network types of the first and second Network devices, which are respectively connected to the scheduler in communication, include a public IP Network, an Upnp (Universal Plug and Play) Network, or an NAT (Network Address Translation) Network.
The IPTV private network is a network where an IPTV system is deployed, and the developer network is a network where a development device (i.e., a second device) is located. In the development and maintenance process of the IPTV system software, in order to enable an external device (such as a second device outside an IPTV private network) to be communicated with an internal device (such as a first device inside the IPTV private network), the networking is carried out by adopting modes of static port mapping, route forwarding, VPN and the like at present, but the existing networking mode is complex and cannot realize rapid networking. The invention solves the problem of complex networking in different places by introducing the centralized issuing configuration of the networking device and the scheduler.
Fig. 2 illustrates a networking communication method based on an IPTV system according to an embodiment of the present invention. For convenience of explanation, only the portions related to the present embodiment are shown. Referring to fig. 1, the networking communication method based on the IPTV system includes steps S201 to S203.
S201, after detecting that a networking device accesses a network, requesting a scheduler to update the current network environment of the networking device, wherein the networking device comprises a first networking device deployed in an IPTV private network environment and a second networking device deployed in a developer network environment, and the scheduler is deployed in a public network environment.
Optionally, each networking device is provided with a unique UID, and the scheduler records the network type of the network environment of the networking device according to the UID of the networking device, so as to adopt a corresponding networking policy according to the network type, but the network type of the network environment after each power-on connection of the networking device is not necessarily the last network type, and therefore the network type of the networking device recorded in the scheduler needs to be updated.
Specifically, the networking device is deployed in two network environments to be communicated (for example, in this embodiment, the first networking device is deployed in an IPTV private network environment, and the second networking device is deployed in a developer network environment), and after the networking device is powered on, the networking device is initialized: the WAN port of the networking device is accessed to the network, connected with the scheduler and requesting the scheduler to update the current network environment, and the scheduler records the network type of the current network environment and the UID of the networking device. The UID is used for corresponding the network type, so that the networking device can be freely deployed, and can be operated by electrifying and networking, and the user operation is facilitated.
S202, judging the network type of the updated network environment, wherein the network type comprises a public IP network, an Upnp network or an NAT network.
The public IP network is a network type that the first network component and/or the second network component is provided with a public network IP, and transmits network data through a peer-to-peer (P2P) transmission technology; the Upnp (Universal Plug and Play) network is a network type based on Upnp protocol, which also transmits network data through P2P.
Optionally, the NAT (Network Address Translation) Network includes a simple NAT Network that can be penetrated by a Network and a complex NAT Network that cannot be penetrated by a Network; wherein the simple NAT network comprises Full Cone NAT, reserved Cone NAT and Port reserved Cone NAT; the complex NAT network is Symmetric NAT.
By judging the network type of the network environment, different networking modes are adopted according to different network types, so that the data connection of different networks is optimized, and the transmission efficiency and the stability are improved.
S203, based on the judgment result of the network type, networking is performed through a preset networking strategy corresponding to the network type, so that a first device in an IPTV private network environment corresponding to the first networking device communicates with a second device in a developer network environment corresponding to the second networking device, wherein the preset networking strategy comprises a direct connection mode, a hole punching mode or a bridging mode.
The network type and the preset networking strategy have a corresponding relationship, and optionally, the public IP network corresponds to a direct connection mode, the Upnp network corresponds to a punching mode, and the NAT network corresponds to a punching mode or a bridging mode.
On the basis of the embodiment shown in fig. 2, fig. 3 shows a flowchart for implementing another networking communication method based on an IPTV system. As shown in fig. 3, step S203 in the embodiment shown in fig. 2 specifically includes steps S2031 to S2033. It should be noted that the steps that are the same as those in the embodiment of fig. 1 are not repeated herein, please refer to the foregoing description.
S2031, when the network type is the public IP network, networking is performed through a direct connection mode, wherein the direct connection mode is that the first networking device and the second networking device communicate through direct connection;
s2032, when the network type is the Upnp network, networking is performed in a hole punching mode, and the hole punching mode is that the first networking device and the second networking device communicate through port mapping;
s2033, when the network type is the NAT network, networking is carried out in a punching mode or a bridging mode, and the bridging mode is that the first networking device and the second networking device establish socket connection with the scheduler to carry out bridging communication.
The direct connection mode is that the first network device and the second network device are directly connected to exchange network data; in the above hole punching manner, the first network component maps an intranet (IPTV private network) port to an extranet (developer network or network environment where the scheduler is located) port of the second network component, and when the second device sends network data to the first device, the extranet port of the second network component receives the network data and forwards the network data to the first device through the intranet port. The bridging mode is that the first networking device and the second networking device respectively establish socket connection with the scheduler according to a sockets 5 proxy protocol.
Optionally, the public IP network, the Upnp network and the simple NAT network adopt P2P to transmit network data, wherein data in the public IP network during transmission does not need to pass through a scheduler, so as to reduce transmission pressure of the scheduler as a central node. The complex NAT network does not use P2P to transmit network data, but relays network data through the scheduler.
On the basis of the embodiment shown in fig. 3, the present embodiment provides a specific manner of step S2033. When the network type is the NAT network, networking through the punching mode or the bridging mode comprises the following steps: when the NAT network is a network penetrable NAT network, networking is carried out through the punching mode; and when the NAT network is a non-network-penetrable NAT network, networking through the bridging mode.
The NAT network includes a simple NAT network that can perform network penetration (e.g., intranet penetration) and a complex NAT network that cannot perform network penetration; optionally, the simple NAT network comprises a fully-Cone NAT (full Cone NAT), a organically-penetrable address-restricted Cone NAT (restricted Cone NAT) and a organically-penetrable port-restricted Cone NAT; the complex NAT network is an impenetrable symmetric NAT (symmetric NAT).
It should be noted that, Full Cone Nat walks the hole punching method, symmetry Nat walks the bridge method, and Port reserved Cone Nat and reserved Cone Nat prefer the hole punching method when the network can be penetrated, and select the bridge method when the network cannot be penetrated.
On the basis of the embodiment shown in fig. 3, this embodiment provides a specific implementation of the hole punching manner in step S2032. The first networker and the second networker communicate through port mapping, and the method includes: requesting an allocation port from the scheduler; and performing port mapping through the port allocated by the scheduler according to the self-increment algorithm so as to enable the first networking device to communicate with the second networking device.
When the network type is an Upnp network or a simple NAT network, the networking device requests the scheduler to allocate a port, the scheduler issues a large port based on an increasing algorithm, the first networking device maps an IPTV private network port to the port issued by the scheduler, when the second networking device needs to send data to the first device, the data is sent to the port issued by the scheduler together, the IPTV private network port forwards the data value to the first device, otherwise, the second networking device maps the developer network port to the port issued by the scheduler, and intercommunication and interconnection with the first networking device are realized. The configuration is centrally issued by a scheduler, so that the rapid networking is realized.
Furthermore, the dispatcher counts the connection result of the issued port according to the UID of the networking device, and subsequently, the port with the connection success record is issued preferentially.
On the basis of the embodiment shown in fig. 3, fig. 4 shows a flowchart for implementing the bridging manner in step S2033. As shown in fig. 4, the bridging manner in S2033 of the embodiment shown in fig. 3 specifically includes steps S401 and S402. It should be noted that the steps that are the same as those in the embodiment of fig. 3 are not repeated herein, please refer to the foregoing description. Referring to fig. 4, the first networker and the second networker communicate by establishing a socket connection with the scheduler, and the method includes:
s401, starting socks5 proxy service of the scheduler;
s402, establishing a socket long connection between the first networking device and a first port of the scheduler, and establishing a sockets 5 proxy between the second networking device and a second port of the scheduler, so that the first networking device and the second networking device perform bridge communication.
The above-mentioned sockets 5 proxy service is a proxy service based on the sockets 5 protocol of socket connection, so the scheduler is also a sockets 5 server, which supports both TCP and UDP protocols, and the socket is a programming interface encapsulating TCP/UDP. The first networker and the second networker establish connection with the dispatcher based on the socks5 proxy to carry out bridge communication, and the configuration of a core network route or a switch does not need to be modified, so that the stability of the system is guaranteed.
On the basis of the embodiment shown in fig. 4, in this embodiment, a specific implementation manner is given that the first device in the IPTV private network environment corresponding to the first network component in step S203 communicates with the second device in the developer network environment corresponding to the second network component, where the specific implementation manner includes:
when the second device sends a network request to the first device, transmitting request data corresponding to the network request sent by the second device to the second port through the second network component; and transmitting the request data received by the second port to the first networking device through the first port, so that the first networking device establishes a connection with the first device.
The process is that the second device performs network access to the first device, and the process realizes that the external device (the second device) performs network access to the internal device (the first device), so that a developer can perform remote maintenance on the IPTV system software development. The scheduler also has data buffering capacity, and the data buffering capacity can buffer the data from the first networking device and the second networking device, so that the data can not be lost.
Further, after the transmitting the request data received by the second port to the first networker through the first port of the scheduler, the method includes: transmitting response data generated after the first networking device receives the request data to the first port; and transmitting the response data received by the first port to the second networking device through the second port.
The request condition is fed back to the second device by the first network component, which is essentially the process of the first device accessing the second device, and the intercommunication and interconnection between the external device (the second device) and the internal device (the first device) are realized, so that a developer can perform remote maintenance of the IPTV system software development, and can also acquire data from the IPTV system.
Further, data of the communication link of the first device and the second device is encrypted by an encryption algorithm, wherein the encryption algorithm may be selected as a symmetric encryption algorithm.
The following describes a specific scenario to illustrate an implementation process of the bridging mode in the embodiment of the present invention. It should be noted that the description is only exemplary and should not be construed as limiting the invention.
The process accesses the first device having address 172.21.1.5 for the second device having address 10.137.1.100. Deploying a dispatcher with a domain name of dispatch.example.com, and monitoring 1080 ports (second ports) of the dispatcher to start socks5 proxy services; starting a first networker and a second networker, and respectively connecting a dispatcher scheduler; the first network device actively establishes a socket long connection with a dispatcher. example. com1195 port (first port), the connection supports a TCP/UDP protocol, and the first network device has a heartbeat and retry mechanism, so that the connection can be ensured to be continuous, and the stability of data transmission is ensured; the second networker establishes a sock5 proxy with the dispatcher example 1080 port, thereby enabling the first networker and the second networker to perform bridge communication by establishing a connection with the dispatcher.
When the second device initiates a network request to the first device, 172.21.1.0/24 requests the packet to be forwarded to the dispatch. And a 1080 port of the scheduler receives the data packet from the second networking device and buffers data in the data packet, and the scheduler sends the buffered data packet to the first networking device through a 1195 port.
And after receiving the data packet sent by the port 1195, the first networking device establishes a TCP/UDP connection with the first device of 172.21.1.5 and requests for data transparent transmission. After the request is completed, the first networker generates response data and transmits the response data back to the port of the scheduler 1195. The scheduler 1195 port buffers the response data, and returns the response data to the second networker through the 1080 port maintaining the connection state, and the second networker completes the socks5 proxy, and the second device of 10.137.1.100 receives the response of the first device of 172.21.1.5.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
Fig. 5 is a schematic structural diagram of a networking communication device based on an IPTV system according to an embodiment of the present invention. For convenience of explanation, only the portions related to the present embodiment are shown. Referring to fig. 2, anetworking communication device 500 based on the IPTV system includes:
anupdating module 501, configured to update a current network environment of a scheduler after detecting that a networking device accesses a network, where the networking device includes a first networking device deployed in an IPTV private network environment and a second networking device deployed in a developer network environment, and the scheduler is deployed in a public network environment;
a determiningmodule 502, configured to determine a network type of the updated network environment, where the network type includes a public IP network, an Upnp network, or an NAT network;
thenetworking module 503 is configured to perform networking through a preset networking policy corresponding to the network type based on the determination result of the network type, so that a first device in an IPTV private network environment corresponding to the first networking device communicates with a second device in a developer network environment corresponding to the second networking device, where the preset networking policy includes a direct connection manner, a hole punching manner, or a bridging manner.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described apparatuses, modules and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
Fig. 6 is a schematic diagram of a terminal device according to an embodiment of the present invention. As shown in fig. 6, theterminal device 6 of this embodiment includes: aprocessor 60, amemory 61 and acomputer program 62, e.g. a program for determining the type of network, stored in saidmemory 61 and executable on saidprocessor 60. Theprocessor 60 executes thecomputer program 62 to implement the steps in each of the embodiments of the networking communication method based on the IPTV system, such as the steps 201 to 203 shown in fig. 1. Alternatively, theprocessor 60, when executing thecomputer program 62, implements the functions of each module/unit in the above-mentioned device embodiments, for example, the functions of themodules 501 to 503 shown in fig. 5.
Illustratively, thecomputer program 62 may be partitioned into one or more modules/units that are stored in thememory 61 and executed by theprocessor 60 to implement the present invention. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution of thecomputer program 62 in theterminal device 6. For example, thecomputer program 62 may be divided into an update module, a determination module, and a networking module (module in a virtual device), and each module has the following specific functions: the updating module is used for updating the current network environment of the scheduler after detecting that the networking device is accessed to the network, wherein the networking device comprises a first networking device deployed in an IPTV private network environment and a second networking device deployed in a developer network environment, and the scheduler is deployed in a public network environment; the judging module is used for judging the network type of the updated network environment, wherein the network type comprises a public IP network, an Upnp network or an NAT network; and the networking module is used for networking through a preset networking strategy corresponding to the network type based on the judgment result of the network type so as to enable first equipment in an IPTV private network environment corresponding to the first networking device to communicate with second equipment in a developer network environment corresponding to the second networking device, wherein the preset networking strategy comprises a direct connection mode, a hole punching mode or a bridging mode.
Theterminal device 6 may be a desktop computer, a notebook, a palm computer, a cloud server, or other computing devices. The terminal device may include, but is not limited to, aprocessor 60, amemory 61. Those skilled in the art will appreciate that fig. 6 is merely an example of aterminal device 6 and does not constitute a limitation ofterminal device 6 and may include more or less components than those shown, or some components in combination, or different components, for example, the terminal device may also include input output devices, network access devices, buses, etc.
TheProcessor 60 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
Thememory 61 may be an internal storage unit of theterminal device 6, such as a hard disk or a memory of theterminal device 6. Thememory 61 may also be an external storage device of theterminal device 6, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on theterminal device 6. Further, thememory 61 may also include both an internal storage unit and an external storage device of theterminal device 6. Thememory 61 is used for storing the computer program and other programs and data required by the terminal device. Thememory 61 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus/terminal device and method may be implemented in other ways. For example, the above-described embodiments of the apparatus/terminal device are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated modules/units, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow of the method according to the embodiments of the present invention may also be implemented by a computer program, which may be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method embodiments may be implemented. . Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present invention, and are intended to be included within the scope of the present invention.