IPTV system and broadcast communication method thereof, and IPTV device

By developing the server in the IPTV system and using the Android architecture interface of the server to perform broadcast operations, the problem that native programs cannot use broadcast functions is solved, and the broadcast sending and receiving capabilities of native programs are realized.

CN119653119BActive Publication Date: 2025-04-29SICHUAN TIANYI COMHEART TELECOM
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510164321.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-14
Publication Date
2025-04-29
Estimated Expiration
2045-02-14

AI Technical Summary

Technical Problem

In IPTV system, native programs cannot use broadcast functions because native programs are developed using C/C++ language, while Android architecture is developed using JAVA language, native programs cannot use interfaces in the Android framework.

Method used

By developing a server in the IPTV system, the server is used instead of the native program to send or receive broadcasts. The server is developed using the Android architecture, and can use the interface of the Android framework to transmit and receive broadcasts, and listen to client messages through socket sets.

Benefits of technology

This enables native programs developed in C/C++ language to use the broadcast function of the IPTV system, solves the problem that native programs cannot send or receive broadcasts, and simplifies the development process of the IPTV system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119653119B_ABST
    Figure CN119653119B_ABST
Patent Text Reader

Abstract

The present application discloses an IPTV system and its broadcast communication method and IPTV equipment, and relates to the field of IPTV technology. The method is applied to a server, which is developed using an Android architecture. The broadcast function in the IPTV system runs based on an Android mechanism. The method includes: creating a socket set, the socket set includes a first socket and a second socket; the first socket and the second socket are used to receive messages sent by a client; executing Os.poll to monitor whether the socket set receives a message; if the first socket in the socket set receives a message, the client's to-be-broadcasted data is obtained, and the to-be-broadcasted data is broadcast; if the second socket in the socket set receives a message, the client needs to register the target broadcast information, and when the target broadcast is received, the target broadcast data is forwarded to the corresponding client. Thus, the native program developed in C / C++ language can use the broadcast function of the IPTV system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of IPTV technology, and in particular to an IPTV system and a broadcast communication method thereof, and an IPTV device. Background Art

[0002] In the development of IPTV systems, using broadcasting to send and receive messages is a common communication method, and it is also the simplest communication method between applications and between applications and frameworks.

[0003] Although broadcast communication simplifies the development of IPTV systems, since broadcasting is based on the Android architecture, applications or frameworks need to implement broadcasting functions through the Android framework interface. However, native programs (binary programs) running on the IPTV system cannot use the broadcasting function of the IPTV system, because native programs are developed using C / C++ language, while the Android architecture is developed using JAVA language. Native programs cannot use the interfaces in the Android framework, so they cannot effectively send or receive broadcasts. Summary of the invention

[0004] The main purpose of this application is to provide an IPTV system and its broadcast communication method and IPTV device, so that native programs developed in C / C++ language can use the broadcast function of the IPTV system.

[0005] To achieve the above object, the present application provides a broadcast communication method of an IPTV system, which is applied to a server, wherein the server is developed using an Android architecture, and the broadcast function in the IPTV system is run based on an Android mechanism. The method includes:

[0006] Creating a socket set, the socket set comprising a first socket and a second socket; the first socket and the second socket are used to receive a message sent by a client;

[0007] Execute Os.poll to monitor whether the socket set receives a message;

[0008] If the first socket in the socket set receives the message, the to-be-broadcast data of the client is obtained, and the to-be-broadcast data is broadcasted;

[0009] If the second socket in the socket set receives a message, the information that the client needs to register for the target broadcast is obtained, and when the target broadcast is received, the data of the target broadcast is forwarded to the corresponding client.

[0010] Optionally, obtaining the data to be broadcasted of the client and broadcasting the data to be broadcasted includes: creating a third socket and adding the third socket to the socket set; the third socket is used to receive the data to be broadcasted sent by the corresponding client; if the third socket receives the data to be broadcasted, broadcasting the data to be broadcasted through an interface in the Android architecture.

[0011] Optionally, the obtaining of the target broadcast information that the client needs to register includes: creating a fourth socket and adding the fourth socket to the socket set; the fourth socket is used to receive the target broadcast information sent by the corresponding client.

[0012] Optionally, the information of the target broadcast includes a broadcast name. Before executing Os.poll to monitor whether the socket set has received a message, the method also includes: creating a hash table, the hash table being used to store registered broadcast names and socket information of corresponding clients; after creating the fourth socket, the method also includes: if the fourth socket receives the broadcast name of the target broadcast, determining the registration status of the target broadcast based on the hash table and the broadcast name of the target broadcast; when the registration status of the target broadcast is registered, adding the fourth socket to the position of the broadcast name of the target broadcast in the hash table; when the registration status of the target broadcast is unregistered, adding the broadcast name of the target broadcast and the fourth socket to the hash table.

[0013] Optionally, the socket set also includes a first socket array, and the first socket array is used to receive broadcasts sent by third-party terminals. The method also includes: if the first socket array receives a broadcast sent by the third-party terminal, based on the broadcast name of the broadcast sent by the third-party terminal and the hash table, forwarding the broadcast data sent by the third-party terminal to the corresponding client.

[0014] Optionally, the method further includes: if the third socket receives a preset message, removing the third socket from the socket set.

[0015] Optionally, the method further includes: if the fourth socket receives a preset message, removing the fourth socket and the broadcast name of the corresponding target broadcast in the hash table, and removing the fourth socket from the socket set.

[0016] In addition, to achieve the above-mentioned purpose, the present application also provides another broadcast communication method of an IPTV system, which is applied to a client, wherein the client includes a native program, and the broadcast function in the IPTV system runs based on the Android mechanism, and the method includes: creating a fifth socket and a sixth socket; wherein the fifth socket is used to communicate with the first socket of the server, and the sixth socket is used to communicate with the second socket of the server; if the client needs to send a broadcast, the data to be broadcast is initialized in the Intent format, and the initialized data to be broadcast is sent to the server using the fifth socket, so that the data to be broadcast can be broadcast through the server; if the client needs to receive a broadcast, the information of the target broadcast to be registered is initialized in the Intent format, and the information of the initialized target broadcast is sent to the server using the sixth socket, so that the target broadcast can be received through the server.

[0017] The present application also provides an IPTV system, including a server and at least one client, the server is developed using the Android architecture, the client includes a native program, and the broadcast function in the IPTV system runs based on the Android mechanism; the server is used to create a socket set, the socket set includes a first socket and a second socket, and executes Os.poll to monitor whether the socket set receives a message; wherein the first socket and the second socket are used to receive messages sent by the client; the server is also used to, if the first socket in the socket set receives a message, obtain the client's to-be-broadcast data and broadcast the to-be-broadcast data; the server is also used to, if the second socket in the socket set receives a message, obtain the information that the client needs to register for a target broadcast, and when the target broadcast is received, forward the target broadcast data to the corresponding client.

[0018] The present application also provides an IPTV device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the broadcast communication method of the IPTV system as described in the first embodiment, or implements the broadcast communication method of the IPTV system as described in the second embodiment.

[0019] In the broadcast communication method of the IPTV system of the present application, the server creates a socket set and uses the first socket in the socket set to receive the client's to-be-broadcast data, and then broadcasts the to-be-broadcast data; secondly, the server can also use the second socket in the socket set to receive the information of the target broadcast that the client needs to monitor, and after receiving the target broadcast, forward the target broadcast data to the client. Because the server is developed based on the Android architecture, the server can use the interface of the Android framework to receive or send broadcasts, and the native program (i.e., the client) can receive or send broadcasts through the server. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 This is a scenario example of the broadcast communication method of the IPTV system provided by this application;

[0021] Figure 2 This is one of the flow charts of the broadcast communication method of the IPTV system of the first embodiment of the present application;

[0022] Figure 3 This is the second flowchart of the broadcast communication method of the IPTV system of the first embodiment of the present application;

[0023] Figure 4 is a flow chart of a broadcast communication method of an IPTV system according to a second embodiment of the present application;

[0024] Figure 5 An example of a physical structure diagram of an IPTV device is shown;

[0025] In the figure: 110, server; 120, client; 510, processor; 520, communication interface; 530, memory; 540, communication bus.

[0026] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0027] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below in conjunction with the drawings in this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0028] Broadcasting is a messaging method that enables components of an Android application to send and receive messages called "Intents" to other components of the same application or other applications. Broadcasting can also be used to notify components about changes in system events.

[0029] In the development of IPTV systems, broadcasting is commonly used to send and receive messages. It is also the simplest communication method between applications and between applications and frameworks (system frameworks). For example, the system can send a broadcast "android.net.conn.CONNECTIVITY_CHANGE", and applications can register to receive the broadcast. When the system network changes, the application will receive the broadcast and then perform subsequent business processing.

[0030] The broadcast mechanism simplifies the development difficulty, but because broadcast is based on the Android mechanism, broadcast is easy to use on APK (application package), but there is no better way to use it for native programs (binary programs) running on IPTV systems. Because native programs are developed using C / C++ language, while Android framework is developed using JAVA language; therefore, native programs cannot use the interfaces in the Android framework, and thus cannot use the broadcast function.

[0031] Based on this, the embodiment of the present application provides an IPTV system and its broadcast communication method, and IPTV device, which solves the problem that native programs developed in C / C++ language cannot use the broadcast function by developing a server in the IPTV system and using the server instead of the native program to send or receive broadcasts.

[0032] For ease of understanding, this specification provides a scenario example of a broadcast communication method of an IPTV system. The scenario example is applied in Figure 1 In the application environment shown, the scenario includes a server 110 and at least one client 120, the server 110 is connected to each client 120 respectively, and the server 110 and each client 120 are both running in the IPTV system of the IPTV device.

[0033] In this scenario example, the IPTV device may be a set-top box, and the IPTV system used by the IPTV device may be an Android system. The client 120 is a native program in the IPTV device. It should be noted that a native program generally refers to an application program written in C / C++ language, and these programs or libraries run directly on the underlying operating system (Linux kernel) of the IPTV device. In contrast to native programs are Android applications written in Java or Kotlin, which run on the Java virtual machine (Dalvik or ART) of the Android system.

[0034] In addition, the server 110 in this scenario example can be developed in an Android application development manner, that is, developed in Java language. Therefore, the server 110 can use the interface of the Android system to send and receive broadcasts.

[0035] With reference to the scenario example of the broadcast communication method of the IPTV system in the aforementioned embodiment, the broadcast communication method of the IPTV system in the embodiment of the present application is described in detail below.

[0036] Figure 2 This is one of the flowcharts of the broadcast communication method of the IPTV system in the first embodiment of the present application. The broadcast communication method of the IPTV system can be executed by the server in the above embodiment, the server is developed using the Android architecture, and the broadcast function in the IPTV system runs based on the Android mechanism. Figure 2 As shown, the broadcast communication method of the IPTV system may include the following steps:

[0037] Step 210: Create a socket set, the socket set includes a first socket and a second socket; the first socket and the second socket are used to receive messages sent by the client.

[0038] It should be noted that the purpose of creating a socket set in this embodiment is to enable the server to only monitor the socket set, so that multiple sockets can be monitored at the same time to know whether each socket has changed, thereby ensuring the timeliness and convenience of monitoring messages.

[0039] In this embodiment, when the server is started, the server first creates a socket set, which can be recorded as mFds. Further, the server can create a first socket and a second socket, and add the first socket and the second socket to the socket set mFds, wherein the first socket can be recorded as sendbroadcast and the second socket can be recorded as registerbroadcast.

[0040] The first socket and the second socket can receive messages sent by each client, and the first socket is used to receive a send broadcast request from each client, and the second socket is used to receive a monitor broadcast request from each client.

[0041] Step 220: Execute Os.poll to monitor whether the socket set receives a message.

[0042] It should be noted that Os.poll is a method used to monitor the status of multiple file descriptors on Unix / Linux platforms. It polls a set of file descriptors and returns a list of ready file descriptors.

[0043] In this embodiment, the server can keep looping and executing Os.poll to monitor whether there are changes in the socket set. Whether there are changes in the socket set means that a socket in the socket set has received a message. Specifically, the poll mechanism allows the server to monitor multiple file descriptors (sockets in this case) in a non-blocking manner to see if they are in a ready state, such as readable or writable. The server will call the poll() method and pass in a set of all sockets to be monitored. Then poll() will block until at least one socket is ready or a timeout occurs.

[0044] If a socket in the socket set receives a message, then for the server, this means that the state of the socket has changed - from no data to be read to data to be read. At this time, the poll() call will return and give a list of all the sockets that have changed and their corresponding event flags. The server can traverse this list, check which sockets have data arriving, and perform corresponding operations on each ready socket, such as reading messages, processing requests, etc.

[0045] Therefore, the server can monitor the first socket and the second socket to see whether they receive the message sent by the client by monitoring the socket set, so as to know whether the client has the intention to send or receive a broadcast.

[0046] Step 230: If the first socket in the socket set receives the message, the data to be broadcasted of the client is obtained, and the data to be broadcasted is broadcasted.

[0047] It should be noted that the data to be broadcast refers to the data that the client needs to broadcast to a third-party application or a system framework.

[0048] In this embodiment, if Os.poll called by the server returns, it means that the socket in the socket set has changed, and the server queries the reason for the change (that is, which socket received the message). If it is determined at this time that the first socket in the socket set has received the message, it means that there is a client that expects to send a broadcast. It should be noted that the message received by the first socket may include the name or identifier of the client, the broadcast name requested to be sent, etc.

[0049] Furthermore, the server obtains the data to be broadcasted from the client. After obtaining the data to be broadcasted, the server can send the broadcast (ie, send the data to be broadcasted) by calling the context.sendBroadcast(Intent) interface in the Android system.

[0050] Figure 3 This is the second flow chart of the broadcast communication method of the IPTV system of the first embodiment of the present application. Figure 3 As shown, in some implementations, obtaining the data to be broadcasted from the client and broadcasting the data to be broadcasted may include the following steps:

[0051] Step 310: Create a third socket and add the third socket to the socket set; the third socket is used to receive the to-be-broadcast data sent by the corresponding client.

[0052] Step 320: If the third socket receives the data to be broadcast, the data to be broadcast is broadcast through the interface in the Android architecture.

[0053] Specifically, when the server determines that the first socket in the socket set has received a message sent by a client, a new socket, namely the third socket, can be established by calling the accept() function. The third socket can be recorded as socket_sendbroadcast. In this embodiment, the newly established third socket is specifically used to receive data from the client. Therefore, the name of the newly created third socket can be stored in correspondence with the name of the client, so that the subsequent server can know which client sent the received message. It should be noted here that the third socket does not refer to a specific socket. As long as it is a socket used to receive data to be broadcast sent by the client, it can be the third socket.

[0054] As an example, if native program A (i.e., client A) and native program B (i.e., client B) are running in the IPTV system, when client B sends a message requesting to send a broadcast to the server through the first socket, the server can first establish a third socket socket_sendbroadcast_B, and use socket_sendbroadcast_B to receive the broadcast data or other data subsequently sent by client B.

[0055] Furthermore, after the third socket is established, the third socket can be added to the above-mentioned socket set first, and then the third socket can be monitored by executing Os.poll to monitor the socket set. If the Os.poll called by the server returns, the server queries the reason for the change and determines that the third socket in the socket set has received the message, which indicates that the third socket has received the data to be broadcast sent by the corresponding client. The server receives the data to be broadcast, extracts the action value and other related data in the data to be broadcast, and further converts this information into an Intent object. The server then uses the context.sendBroadcast (Intent) interface in the Android system framework to send the Intent broadcast, and all broadcast receivers that have registered the corresponding IntentFilter on the server can receive the broadcast.

[0056] It should be noted that the action value is usually used to identify the specific type or purpose of the broadcast message. It helps the receiver understand the intent of the received broadcast information and take appropriate actions accordingly.

[0057] Because the server is developed in the Android application development mode, the server can call the context.sendBroadcast(Intent) interface in the Android system framework to send broadcasts. This embodiment establishes a communication connection between the client (i.e., the native program) and the server, so that the server acts as a proxy for the client to send broadcasts, thereby enabling the native program to send broadcasts, thereby facilitating the development of the IPTV system.

[0058] Step 240: If the second socket in the socket set receives the message, the information that the client needs to register for the target broadcast is obtained, and when the target broadcast is received, the data of the target broadcast is forwarded to the corresponding client.

[0059] It should be noted that the target broadcast refers to the broadcast that the client expects to register and listen to. The target broadcast can be a broadcast sent by a third-party application or a system framework.

[0060] In this embodiment, if Os.poll called by the server returns, it means that the socket in the socket set has changed, and the server queries the reason for the change (that is, which socket received the message). If it is determined that the second socket in the socket set has received the message, it means that there is a client that expects to register to listen to the broadcast. It should be noted that the message received by the second socket may include the name or identifier of the client.

[0061] Furthermore, the server obtains the target broadcast information that the client needs to register. If the client and the corresponding target broadcast are registered on the server, whenever the server receives the target broadcast, the server will forward the target broadcast to the corresponding client.

[0062] In some implementations, before executing Os.poll to monitor whether the socket set receives a message, the broadcast communication method of the IPTV system may further include: creating a hash table, the hash table being used to store registered broadcast names and corresponding client socket information.

[0063] In this embodiment, after the server is started, the server can also create another hash table, which can be recorded as hash_tables. The hash table stores the registered broadcast names and the socket information of the corresponding clients. The clients corresponding to the registered broadcast refer to the clients that need to monitor the broadcast. There may be more than one client monitoring a broadcast, so a broadcast name may correspond to the socket information of multiple clients.

[0064] By creating a hash table, the server can subsequently query the hash table to find out which clients the received broadcast needs to be forwarded to, as well as the socket information of these clients.

[0065] In some implementations, obtaining the target broadcast information that the client needs to register in step 240 may include: creating a fourth socket and adding the fourth socket to the socket set; the fourth socket is used to receive the target broadcast information sent by the corresponding client.

[0066] Specifically, when the server determines that the second socket in the socket set has received a message sent by a client, a new socket, namely the fourth socket, can be established through the accept() function call. The fourth socket can be recorded as socket_registerbroadcast. In this embodiment, the newly established fourth socket is specifically used to receive data from the client. Therefore, the name of the newly created fourth socket can be stored in correspondence with the name of the client, so that the subsequent server can know which client sent the received message, or can use the fourth socket to send a broadcast to the corresponding client based on the correspondence between the fourth socket name and the client name. It should be noted here that the fourth socket does not refer to a specific socket. As long as it is a socket used to receive the target broadcast information sent by the client, it can be the fourth socket.

[0067] Furthermore, after the server establishes the fourth socket, the fourth socket can be added to the above socket set, and then the fourth socket can be monitored by executing Os.poll to monitor the socket set. If the Os.poll called by the server returns, the server queries the reason for the change and determines that the fourth socket in the socket set has received the message, which indicates that the fourth socket has received the target broadcast information sent by the corresponding client.

[0068] In some embodiments, the information of the target broadcast may include a broadcast name. After creating the fourth socket, the broadcast communication method of the IPTV system may further include: if the fourth socket receives the broadcast name of the target broadcast, determining the registration status of the target broadcast based on the hash table and the broadcast name of the target broadcast; if the registration status of the target broadcast is a registered state, adding the fourth socket at the position of the broadcast name of the target broadcast in the hash table; if the registration status of the target broadcast is an unregistered state, adding the broadcast name of the target broadcast and the fourth socket in the hash table.

[0069] Specifically, when the fourth socket in the socket set receives a message, the message is analyzed, and the broadcast name of the target broadcast that the client needs to monitor is extracted from the message. Furthermore, the server determines the registration status of the target broadcast based on the broadcast name of the target broadcast and the hash table. In this embodiment, the registration status may include a registered state and an unregistered state. Specifically, the server can query the broadcast name of the target broadcast in the hash table. If the broadcast name of the target broadcast exists in the hash table, it indicates that the target broadcast has been registered, and the registration state of the target broadcast is the registered state; if the broadcast name of the target broadcast does not exist in the hash table, it indicates that the target broadcast is not registered, and the registration state of the target broadcast is the unregistered state.

[0070] When the registration status of the target broadcast is registered, the server can only add the fourth socket of the client that initiated the registration request to the hash table, and add it to the target broadcast position, so that the fourth socket of the client that initiated the registration request is stored correspondingly with the broadcast name of the target broadcast. When the server receives the target broadcast, the server can determine which clients need to send the target broadcast by querying the hash table.

[0071] As an example, if native program A (i.e., client A) and native program B (i.e., client B) are running in the IPTV system, when client A sends a message requesting to register a broadcast to the server through the second socket, the server can first establish a fourth socket socket_registerbroadcast_A and add socket_registerbroadcast_A to the socket set. Furthermore, if the server subsequently receives the target broadcast sent by client A through socket_registerbroadcast_A and the broadcast name is broadcast 1#, the server first queries whether broadcast 1# exists in the hash table. Assuming that broadcast 1# exists in the hash table, it only needs to add socket_registerbroadcast_A to the hash table, so that the server can use socket_registerbroadcast_A to forward the data of broadcast 1# to client A after receiving broadcast 1#.

[0072] When the registration status of the target broadcast is unregistered, the server needs to add the fourth socket of the client that initiated the registration request and the broadcast name of the corresponding target broadcast to the hash table. At the same time, the server can register the target broadcast by calling the mContext.registerReceiver() function. When a third-party application or system sends the target broadcast to the server, the interface specified when mContext.registerReceiver registers the target broadcast will receive the message. Further, the server can find the fourth socket corresponding to the client by querying the hash table, and use the fourth socket to forward the data of the target broadcast to the client.

[0073] As an example, if native program A (i.e., client A) and native program B (i.e., client B) are running in the IPTV system, when client A sends a message requesting to register a broadcast to the server through the second socket, the server can first establish a fourth socket socket_registerbroadcast_A and add socket_registerbroadcast_A to the socket set. Furthermore, if the server subsequently receives a broadcast named broadcast 1# sent by client A through socket_registerbroadcast_A, the server first queries the hash table to see if broadcast 1# exists. Assuming that broadcast 1# does not exist in the hash table, socket_registerbroadcast_A and broadcast 1# need to be added to the hash table accordingly, so that the server can use socket_registerbroadcast_A to forward the data of broadcast 1# to client A after receiving broadcast 1#.

[0074] In some embodiments, the socket set also includes a first socket array, which is used to receive broadcasts sent by third-party terminals. The method may also include: if the first socket array receives a broadcast sent by a third-party terminal, based on the broadcast name and hash table of the broadcast sent by the third-party terminal, forwarding the broadcast data sent by the third-party terminal to the corresponding client.

[0075] It should be noted that the third-party terminal described in the embodiments of the present application may refer to a third-party application, or an IPTV system.

[0076] Specifically, after startup, the server can also create a pair of socket data groups, namely the first socket data group pipe[0] and the second socket data group pipe[1], and add the first socket data group pipe[0] to the socket set for monitoring. The server can receive broadcasts sent by a third-party application or IPTV system through this pair of socket data groups.

[0077] When other applications or IPTV systems send broadcasts, the interface specified when mContext.registerReceiver registers the broadcast will receive the message. The server can write the received broadcast Intent object to the second socket data group pipe[1] to trigger the first socket data group pipe[0] to receive data. By creating the first socket data group pipe[0] and the second socket data group pipe[1], timely triggering can be achieved after the server receives the broadcast message, thereby improving the efficiency of broadcast transmission and reception.

[0078] When the Os.poll call by the server returns, and the server queries the cause of the change and determines that the first socket data group pipe[0] in the socket set has received the message, it means that there is broadcast data sent by a third-party application or system that needs to be processed. At this time, the Intent object received through the first socket data group pipe[0] can be parsed to obtain the action value in the Intent object, and then the broadcast name of the received broadcast can be obtained.

[0079] Furthermore, the server can search for the fourth socket matching the received broadcast name in the hash table, convert the Intent object into a string, and forward the string to the corresponding client through each matching fourth socket. After processing the broadcast, the server returns to the loop to continue waiting for the next message on Os.poll.

[0080] In some implementations, the broadcast communication method of the IPTV system may further include: if the third socket receives a preset message, removing the third socket from the socket set.

[0081] It should be noted that the preset message can be set by the staff, and the preset message is, for example: -1, and the preset message is used to indicate that the client has been disconnected.

[0082] Specifically, when the server receives a preset message through the third socket, it means that the client corresponding to the third socket has been disconnected. At this time, the third socket can be closed and removed from the socket set to complete resource recovery.

[0083] As an example, if native program A (i.e., client A) and native program B (i.e., client B) are running in the IPTV system, when client B sends a message requesting to send a broadcast to the server through the first socket, the server can first establish a third socket socket_sendbroadcast_B, and use socket_sendbroadcast_B to receive the broadcast data or other data subsequently sent by client B. When recv returns -1 on socket_sendbroadcast_B, it means that client B has been disconnected, then socket_sendbroadcast_B is closed and removed from the socket combination.

[0084] In some implementations, the broadcast communication method of the IPTV system may further include: if the fourth socket receives a preset message, removing the fourth socket and the broadcast name of the corresponding target broadcast in the hash table, and removing the fourth socket from the socket set.

[0085] Specifically, when the server receives a preset message through the fourth socket, it means that the client corresponding to the fourth socket has been disconnected. At this time, the fourth socket can be closed and removed from the hash table and the socket set. If the target broadcast corresponding to the connection of the fourth socket only corresponds to the fourth socket, the broadcast name of the target broadcast is also removed from the hash table to complete resource recovery.

[0086] As an example, if native program A (i.e., client A) and native program B (i.e., client B) are running in the IPTV system, and the fourth socket corresponding to client A in the server is socket_registerbroadcast_A, the broadcast name of the target broadcast registered by client A through socket_registerbroadcast_A is broadcast 1#, and in the hash table, broadcast 1# is only stored corresponding to socket_registerbroadcast_A. If recv returns -1 on socket_registerbroadcast_A, it means that client A has been disconnected. At this time, the server can remove broadcast 1# and socket_registerbroadcast_A from the hash table, and remove socket_registerbroadcast_A from the socket set.

[0087] Therefore, a communication connection is established between the server and each client (i.e., native program). The server is developed using the Android application development method, so the server can call the interface for broadcasting in the Android system framework. Therefore, each client can receive and send broadcasts through the server, allowing native programs developed in C / C++ language to use the broadcasting function of the IPTV system.

[0088] Based on the above embodiments, the embodiments of the present application also provide another broadcast communication method of an IPTV system. The broadcast communication method of the other IPTV system can be executed by a client, the client includes a native program, and the broadcast function in the IPTV system runs based on the Android mechanism.

[0089] Figure 4 1 is a flow chart of the broadcast communication method of the IPTV system of the second embodiment of the present application. Figure 4 As shown, the broadcast communication method of the IPTV system may include the following steps:

[0090] Step 410: Create a fifth socket and a sixth socket; wherein the fifth socket is used to communicate with the first socket of the server, and the sixth socket is used to communicate with the second socket of the server.

[0091] Step 420: If the client needs to send a broadcast, the data to be broadcast is initialized according to the Intent format, and the initialized data to be broadcast is sent to the server using the fifth socket, so that the data to be broadcast is broadcasted through the server.

[0092] Step 430: If the client needs to receive broadcasts, the target broadcast information to be registered is initialized in the Intent format, and the initialized target broadcast information is sent to the server using the sixth socket, so as to receive the target broadcast through the server.

[0093] It should be noted that the client of the embodiment of the present application is a native program, which is developed in C / C++ language and then compiled into an executable program.

[0094] In this embodiment, the process of the client sending a broadcast can be: the client creates a fifth socket, the fifth socket can be recorded as unix socket s1, and the fifth socket can establish a communication connection with the first socket and the third socket in the server. When the client needs to send a broadcast to a third-party application or system, the client can first use the fifth socket to send a request message to the first socket in the server, and then the client initializes the data to be broadcast according to the Intent format. The data to be broadcast contains the action string of the broadcast, that is, the broadcast name to be sent. Furthermore, the client can use the fifth socket unix socket s1 to send the data to be broadcast to the third socket of the server. After the sending is completed, the fifth socket unix socket s1 can be closed.

[0095] The process of the client receiving the target broadcast can be as follows: the client creates the sixth socket, which can be recorded as unix socket s2, and the sixth socket can establish a communication connection with the second socket and the fourth socket in the server. When the client needs to register to listen to the target broadcast, the client can first initialize the information of the target broadcast according to the Intent format. The information of the target broadcast contains the action string of the target broadcast, that is, the broadcast name of the target broadcast that needs to be registered. Further, the client can use the sixth socket unix socket s2 to send the broadcast name of the target broadcast to the second socket of the server, so that the server can register the target broadcast based on the broadcast name of the target broadcast.

[0096] When other applications or systems send a target broadcast, the server receives the target broadcast and converts the Intent object in the target broadcast into a string. The server further queries the corresponding relationship between the broadcast name of the target broadcast and the fourth socket in the hash table, and sends the Intent string to the corresponding client. After the client receives the Intent string through the sixth socket unixsocket s2, it processes the Intent string to extract the broadcast name and broadcast data in the Intent string. When the client does not need to monitor the broadcast, it can close the sixth socket unix socket s2, and the server will also recycle resources.

[0097] As a result, each client can receive and send broadcasts through the server, allowing native programs developed in C / C++ language to use the broadcast function of the IPTV system.

[0098] It should be noted that for details not disclosed in the second broadcast communication method for an IPTV system in this embodiment, please refer to the details disclosed in the embodiment of the first broadcast communication method for an IPTV system in the embodiments of this specification, and no further details will be given here.

[0099] Based on the above embodiments, the present invention further provides an IPTV system, which may include a server and at least one client. The server is developed using the Android architecture, the client includes a native program, and the broadcast function in the IPTV system runs based on the Android mechanism.

[0100] The server is used to: create a socket set, the socket set includes a first socket and a second socket, and execute Os.poll to monitor whether the socket set receives a message; wherein the first socket and the second socket are used to receive messages sent by the client. The server is also used to: if the first socket in the socket set receives a message, obtain the client's data to be broadcast, and broadcast the data to be broadcast. The server is also used to: if the second socket in the socket set receives a message, obtain the information that the client needs to register for the target broadcast, and when the target broadcast is received, forward the target broadcast data to the corresponding client.

[0101] The client is used to: create a fifth socket and a sixth socket; wherein the fifth socket is used to communicate with the first socket of the server, and the sixth socket is used to communicate with the second socket of the server. The client is also used to: if a broadcast needs to be sent, initialize the data to be broadcasted according to the Intent format, and use the fifth socket to send the initialized data to be broadcasted to the server, so that the data to be broadcasted can be broadcasted through the server. The client is also used to: if a broadcast needs to be received, initialize the information of the target broadcast to be registered according to the Intent format, and use the sixth socket to send the initialized target broadcast information to the server, so that the target broadcast can be received through the server.

[0102] Therefore, the server creates a socket set, and uses the first socket in the socket set to receive the client's data to be broadcast, and then broadcasts the data to be broadcast; secondly, the server can also use the second socket in the socket set to receive the target broadcast information that the client needs to monitor, and after receiving the target broadcast, forward the target broadcast data to the client. Because the server is developed based on the Android architecture, the server can use the interface of the Android framework to receive or send broadcasts, and the native program (ie, the client) can receive or send broadcasts through the server.

[0103] It should be noted that for details not disclosed in the IPTV system of this embodiment, please refer to the details disclosed in the embodiments of the first IPTV system broadcast communication method or the second IPTV system broadcast communication method in this specification, which will not be repeated here.

[0104] Figure 5 An example of a physical structure diagram of an IPTV device is shown below. Figure 5 As shown, the IPTV device may include: a processor 510, a communication interface 520, a memory 530 and a communication bus 540, wherein the processor 510, the communication interface 520, and the memory 530 communicate with each other through the communication bus 540. The processor 510 may call the logic instructions in the memory 530 to execute the broadcast communication method of the first IPTV system, or execute the broadcast communication method of the second IPTV system.

[0105] In addition, the logic instructions in the above-mentioned memory 530 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0106] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the computer program is executed by a processor to execute the broadcast communication method of the first IPTV system or the broadcast communication method of the second IPTV system.

[0107] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0108] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0109] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A broadcast communication method for an IPTV system, characterized in that: Applied to a server, the server is developed using an Android architecture, the broadcast function in the IPTV system runs based on an Android mechanism, and the method includes: Creating a socket set, the socket set comprising a first socket and a second socket; the first socket and the second socket are used to receive a message sent by a client; the client comprises a native program; Execute Os.poll to monitor whether the socket set receives a message; If the first socket in the socket set receives the message, the to-be-broadcast data of the client is obtained, and the to-be-broadcast data is broadcasted; If the second socket in the socket set receives a message, the information that the client needs to register for the target broadcast is obtained, and when the target broadcast is received, the data of the target broadcast is forwarded to the corresponding client.

2. The broadcast communication method of the IPTV system according to claim 1, characterized in that: The obtaining the data to be broadcasted from the client and broadcasting the data to be broadcasted includes: Creating a third socket and adding the third socket to the socket set; the third socket is used to receive the data to be broadcasted sent by the corresponding client; If the third socket receives the data to be broadcast, the data to be broadcast is broadcast through an interface in the Android architecture.

3. The broadcast communication method of the IPTV system according to claim 1, characterized in that: The obtaining of the target broadcast information that the client needs to register includes: A fourth socket is created and added to the socket set; the fourth socket is used to receive target broadcast information sent by the corresponding client.

4. The broadcast communication method of the IPTV system according to claim 3, characterized in that: The target broadcast information includes a broadcast name. Before executing Os.poll to monitor whether the socket set receives a message, the method further includes: Create a hash table, the hash table is used to store the registered broadcast name and the socket information of the corresponding client; After creating the fourth socket, the method further comprises: If the fourth socket receives the broadcast name of the target broadcast, determining the registration status of the target broadcast based on the hash table and the broadcast name of the target broadcast; In a case where the registration state of the target broadcast is a registered state, adding the fourth socket at the broadcast name position of the target broadcast in the hash table; In a case where the registration state of the target broadcast is an unregistered state, the broadcast name of the target broadcast and the fourth socket are added to the hash table.

5. The broadcast communication method of the IPTV system according to claim 4, characterized in that: The socket set further includes a first socket array, and the first socket array is used to receive a broadcast sent by a third-party terminal. The method further includes: If the first socket array receives the broadcast sent by the third-party terminal, based on the broadcast name of the broadcast sent by the third-party terminal and the hash table, the data broadcasted by the third-party terminal is forwarded to the corresponding client.

6. The broadcast communication method of the IPTV system according to claim 2, characterized in that: The method further comprises: If the third socket receives a preset message, the third socket is removed from the socket set.

7. The broadcast communication method of the IPTV system according to claim 4, characterized in that: The method further comprises: If the fourth socket receives the preset message, the fourth socket and the broadcast name of the corresponding target broadcast are removed from the hash table, and the fourth socket is removed from the socket set.

8. A broadcast communication method for an IPTV system, characterized in that: Applied to a client, the client includes a native program, the broadcast function in the IPTV system runs based on an Android mechanism, and the method includes: Creating a fifth socket and a sixth socket; wherein the fifth socket is used to communicate with the first socket of the server, and the sixth socket is used to communicate with the second socket of the server; If the client needs to send a broadcast, the data to be broadcast is initialized according to the Intent format, and the initialized data to be broadcast is sent to the server by using the fifth socket, so that the data to be broadcast is broadcasted through the server; If the client needs to receive broadcasts, the target broadcast information to be registered is initialized according to the Intent format, and the initialized target broadcast information is sent to the server using the sixth socket, so as to receive the target broadcast through the server.

9. An IPTV system, characterized in that: It includes a server and at least one client, wherein the server is developed using the Android architecture, the client includes a native program, and the broadcast function in the IPTV system runs based on the Android mechanism; The server is used to create a socket set, the socket set includes a first socket and a second socket, and execute Os.poll to monitor whether the socket set receives a message; wherein the first socket and the second socket are used to receive a message sent by the client; The server is further configured to, if the first socket in the socket set receives a message, obtain the data to be broadcasted from the client, and broadcast the data to be broadcasted; The server is also used to, if the second socket in the socket set receives a message, obtain the information that the client needs to register for the target broadcast, and forward the data of the target broadcast to the corresponding client when the target broadcast is received.

10. An IPTV 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 broadcast communication method of the IPTV system according to any one of claims 1 to 7 is implemented, or the broadcast communication method of the IPTV system according to claim 8 is implemented.

Citation Information

Patent Citations

  • Android terminal and method for realizing TR069 network management agent

    CN104184618A

  • Smart television system

    CN106412466A