A method of linking barrage and mobile terminal
A barrage, socket technology, applied in image communication, selective content distribution, electrical components, etc., can solve the problems of easy interruption of connection, unstable network, and slow recovery process.
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0025] See figure 1 The flow diagram of a method of linking the bracket provided by the embodiment of the present invention, specifically includes:
[0026] 101. Create the related data of the socket Socket and link with the barrage server.
[0027] The mobile terminal creates the related data of the socket socket and links the barrage server. Where related data includes int SockFD = Socket (AF_INET, SOCK_STREAM, 0), address family servaddr.sin_family = IP, port number (servaddr.sin_port = htons (port)) and system function int nret = connect (Sockfd, (Struct SockAddr) *) & servaddr, sizeof (servaddr)).
[0028]102. Determine the network interrupt object SocketBreaker.
[0029] The mobile terminal determines the network interrupt object SocketBreaker, which is used to trigger the Socket interrupt current link. Specifically, the mobile terminal defines an object function socketbreaker PIPE, which is used to terminate the current link to the Socket chain contact.
[0030] 103. Creati...
specific Embodiment
[0059] Incidentally, in the above embodiment, the present invention can also be implemented in other ways, for example, the design of the upper socket queue-based message, and to process the data received socket data to be transmitted, the specific embodiment for example:
[0060] Step 1, to determine the C ++ classes to process encapsulated data network.
[0061] The function of this step is a step corresponding to the code in the upper layer, which will receive all event messages in the event. First, the present embodiment is designed a c ++ classes that encapsulate process all network data, and the data will occur, the reception data, and during the entire socket of of the socket errors isolated design, so that the logic clearer reception data event is only responsible for the data received, the data event occurs only responsible for sending data, socket socket error event is only responsible for error handling. class TcpClient {a message queue which is designed to store all th...
Embodiment 3
[0072] Incidentally, in the above embodiment, the present invention can also be implemented in other ways, e.g., based on the status code to design socket linking scheme, even if the re-design of specific embodiment are as follows:
[0073] Step 1, to generate a mapping table stored in the status code.
[0074] First, there are many state code, an error occurs when a socket, you need to get the current status code generated to query the need for reconnection. When it comes to the query you need to consider the performance of queries. To store status codes based on the standard template library STL container map container according to the present embodiment. When the query is searched based on map container can be fairly rapid, map mapStatus; present embodiment defines a map type object mapStatus. in. The first parameter is a key value map int a container for storing a status code socket, bool second parameter code for storing the current state of the need for reconnection. Next,...
PUM
Login to View More Abstract
Description
Claims
Application Information
Login to View More 


