Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

System and method for counting number of online client sides based on TCP/IP communication protocol

A technology of IP communication and statistical methods, applied in the field of network communication, can solve the problems of inaccurate number of online clients, users cannot continue to communicate with the server, etc., to enhance stability, reliability and accuracy, and enhance statistical accuracy. Effect

Active Publication Date: 2017-03-15
SHENZHEN INST OF ADVANCED TECH
View PDF4 Cites 10 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0004] After the GPRS communication link is established, the client that does not transmit data within a certain period of time is automatically disconnected. In fact, there are many factors for TCP disconnection. The server may not be able to detect the disconnection of the TCP connection in a timely and effective manner due to abnormal disconnections caused by reasons such as network crashes, network crashes, and forced shutdown of the client software. Obviously, the number of online clients counted is inaccurate, because even if the TCP connection between the client and the server is abnormally disconnected, it still exists on the server. In fact, a "dead connection" is established, and the user cannot Continue to communicate with the server

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • System and method for counting number of online client sides based on TCP/IP communication protocol
  • System and method for counting number of online client sides based on TCP/IP communication protocol
  • System and method for counting number of online client sides based on TCP/IP communication protocol

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0097] Example 1 - A new client initiates a TCP connection request

[0098] see Figure 4 , a flow chart of steps for the event processing of a new client initiating a TCP connection request provided by this application, including the following steps:

[0099] S11: The epoll_wait function finds that the event to be processed is exactly equal to the listening socket descriptor socket_fd;

[0100] S12: Call the accept function according to socket_fd to return a new socket socket descriptor, denoted as fd;

[0101] S13: Add the monitored fd to the epoll handle through the epoll_ctl function.

[0102] It can be understood that the occurrence of this client event does not immediately complete the online work of the client (requires the online command below), but only requires the client to initiate a TCP connection request before obtaining the fd assigned to it by the server, because the client who has already established a connection The terminal must pass fd to transmit data w...

Embodiment 2

[0103] Example 2 - The event that the client that has established the connection disconnects the TCP connection

[0104] see Figure 5 , a flow chart of the steps of the event that the client that has established the connection disconnects the TCP connection provided by the application, including the following steps:

[0105] Step S21: The epoll_wait function finds that the triggering event to be processed is a socket descriptor, denoted as fd;

[0106] Step S22: calling the read function according to fd;

[0107] Step S23: judge whether the return value of the read function is equal to 0, if so, go to the next step; if not, go to other transaction processing;

[0108] Step S24: Find the location of the node according to the fd of the client that initiated the disconnection request, and delete the node from the dynamic linked list.

[0109] It can be understood that if the client that has already established a connection disconnects the TCP connection, then the return value...

Embodiment 3

[0111] Example 3 - The client that has established a TCP connection has an event of online command transmission

[0112] see Figure 8 , the processing flow chart of the event that the client that has established a TCP connection has an online command transmission provided by this application, including the following steps:

[0113] Step S31: The epoll_wait function finds that the triggering event to be processed is a socket descriptor, denoted as fd;

[0114] Step S32: calling the read function according to fd;

[0115] Step S33: judging whether the read return value is greater than 0, if so, go to the next step; if not, go to other processing;

[0116] Step S34: Determine whether the data packet is HEL; xxxxxxxxxxx; @ format, wherein HEL is the abbreviation of hello, xxxxxxxxxxxx is the ID of the client, separated by a semicolon ";", and ends with @ at the end, if so, proceed to the following One step; if not, proceed to other transactions;

[0117] Step S35: Extract the...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention provides a system for counting the number of online client sides based on a TCP / IP communication protocol. The system comprises a server and at least one client side connected with the server; the server is used for creating a dynamic link table; the dynamic link table comprises a head node and a plurality of child nodes; various nodes are sequentially connected in series through a pointer field next, so that the dynamic link table is formed; the server judges whether a communication event is triggered at the client side by calling an epoll_wait function; if so, the server quits the epoll_wait function, traverses and processes the communication event; and if not, the server waits for triggering of the communication event of the client side in a blocking manner. According to the system and the method provided by the invention, the number of the online client sides is counted in a dynamic link table manner by utilization of an epoll server communication model; furthermore, a client side heartbeat packet processing mechanism is added; in combination with the dynamic link table, a node, where an abnormally disconnected client side is, can be cleaned in time; and thus, the accuracy of counting the number of the online client sides can be improved.

Description

technical field [0001] The invention relates to the technical field of network communication, in particular to a system and method for counting the number of online clients based on the TCP / IP communication protocol. Background technique [0002] At present, the technical solution for realizing the statistics of the number of online clients and the highest number of visiting users is mainly aimed at accessing websites or servers based on the HTTP protocol. The more mature solution is to use the event listener (Listener) defined in the Servlet specification to implement, but Only rough statistics can be made, and it is difficult to be accurate. For example, if the user closes the browser without logging out, then the user still exists in the session on the server side, resulting in statistical errors' [0003] In the field of the Internet of Things, most of the wearable devices and smart phone devices are often connected to the server based on the TCP protocol. For the Linux ...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Applications(China)
IPC IPC(8): H04L12/26
CPCH04L43/10
Inventor 宁运琨赵国如梁升云李慧奇
Owner SHENZHEN INST OF ADVANCED TECH
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products