A kind of method and apparatus of data timeout treatmentTechnical field
This application involves view networking technology fields, and the method and a kind of data more particularly to a kind of data timeout treatment are superWhen the device that handles.
Background technique
It is the important milestone of network Development depending on networking, is the more advanced form of internet, is a real-time network, it canIt realizes the whole network HD video real-time Transmission that current internet cannot achieve, pushes numerous Internet applications to HD video,High definition is face-to-face.It will finally realize that the world without distance, realizes that the distance of person to person in global range is the distance of a screen.
As view networking is in nationwide extensive use, the use demand amount depending on networked server is constantly expanding.It is forwarding view networked clients and Relational DBMS based on the distributed data base frame major function depending on networkingThe data transmitted between MySQL database pass through in the distributed data base frame connection based on view networking depending on networked clientsMySQL database, and database is forwarded the data to by data receiver sending module and carries out data manipulation, by the sound of databaseMessage is answered to be transmitted to view networked clients, when view networked clients and the network of the distributed data base frame based on view networking are sent outWhen raw failure, the connection thread of the view networked clients is had, also based on the distributed data base frame depending on networking with thisIt is easy to cause view networked server pressure excessive, system resource occupies excessively high.
Summary of the invention
In view of the above problems, it proposes the embodiment of the present application and overcomes the above problem or at least partly in order to provide one kindA kind of method of the data timeout treatment to solve the above problems and a kind of corresponding device of data timeout treatment.
To solve the above-mentioned problems, the embodiment of the present application discloses a kind of method of data timeout treatment, and the method is answeredFor regarding in networking, the view networking includes view networked server, is based on connecting depending on networking protocol depending on networked server with describedMultiple view networked clients, which comprises
The view networked server successively receives N number of data packet that view networked clients are sent;Wherein, N is positive integer, instituteState the identification marking that data packet carries the view networked clients;
It is described depending on networked server when receiving n-th data packet, record the first time of the n-th data packetStamp;
The view networked server judges the time difference of current time stamp and first time stamp;
If the time difference is greater than preset first time threshold, the view networked server is with the first timeThreshold value is the period, periodically detects and whether receives the N+1 data packet for carrying same identification marking;
The view networked server, will be with the knowledge when not receiving the N+1 data packet for detection every timeCorresponding view networked clients are not identified carries out primary time-out record;
When the time-out record number for the view networked clients is big greater than preset times threshold value or the time differenceIt is described to be disconnected with described depending on networked clients depending on networked server in preset second time threshold.
Optionally, described to further include and the first data of network area where itself being connect depending on networked clients depending on networkingLibrary, the method also includes:
N number of data packet is by first database generation when receiving the trigger action of data update;DescribedOne database is used to N number of data packet being sent to the view networked clients.
Optionally, it is described depending on networked clients be used for by the data packet be sent to view networked server before, the methodFurther include:
It is described to be used to receive the internet data that the first database internet protocol-based is sent depending on networked clientsPacket;
It is described to be used to be based on depending on networked clients that the internet data packet to be converted to view networking data depending on networking protocolPacket.
Optionally, it is described depending on networking further include with second database being connect depending on networked server, the method is alsoInclude:
It is described depending on networked server when receiving n-th data packet, the n-th data packet is sent to described secondIt is stored in database.
Optionally, the data packet is that standard regards networking data packet, and the standard regards networking data packet as 1024 bytes.
Optionally, the first time threshold is 1.5~3 seconds.
Optionally, the preset times threshold value is 16 times, and the second time threshold is 30 seconds~60 seconds.
To solve the above-mentioned problems, the embodiment of the present application also discloses a kind of device of data timeout treatment, described deviceApplied in view networking, the view networking includes view networked server, is based on view networking protocol with the view networked server and connectsThe multiple view networked clients connect, described to be comprised the following modules depending on networked server:
Packet-receiving module, the N number of data packet sent for successively receiving view networked clients;Wherein, N is positive wholeNumber, the data packet carry the identification marking of the view networked clients;
Stamp logging modle at the first time, for when receiving n-th data packet, recording the of the n-th data packetOne timestamp;
Time difference judgment module, for judging the time difference of current time stamp and first time stamp;
Periodicity detection module, for when the time difference is greater than preset first time threshold, then with described theOne time threshold is the period, periodically detects and whether receives the N+1 data packet for carrying same identification marking;
Overtime logging modle, for for every time detection, when not receiving the N+1 data packet, will with it is describedThe corresponding view networked clients of identification marking carry out primary time-out record;
It is default for being greater than in the time-out record number for the view networked clients depending on networked clients management moduleWhen frequency threshold value or the time difference are greater than preset second time threshold, disconnected with described depending on networked clients.
The embodiment of the present application also provides a kind of devices, comprising:
One or more processors;With
One or more machine readable medias of instruction are stored thereon with, are executed when by one or more of processorsWhen, so that the method that described device executes one or more described in the embodiment of the present application.
The embodiment of the present application also provides one or more machine readable medias, are stored thereon with instruction, when by one orWhen multiple processors execute, so that the method that the processor executes one or more described in the embodiment of the present application.
The embodiment of the present application includes the following advantages:
The characteristic of the embodiment of the present application application view networking is receiving n-th data packet for same view networked clientsAfterwards, it is stabbed with the first time for receiving n-th data packet as starting point, using the first time threshold as the period, is periodically detectedWhether receive the N+1 data packet for carrying same identification marking, first carry out time-out record judgement, after the just company of turning offJudgement is connect, can both disconnect in time connection when this is out of touch depending on networked clients in this way, discharges server system pressurePower also can avoid causing to judge by accident depending on networked clients to this, cause to repeat to connect with this depending on networked clients to influence data transmissionEfficiency;
The characteristic of the embodiment of the present application application view networking, is just forwarded to for the data packet when receiving a data packetData packet, is forwarded the mode of backup, avoidable data packet is deposited in view networked server by the backup of two database purchases one by oneThe problem of interior its memory of occupancy, while can guarantee the timeliness and integrality of data backup.
Detailed description of the invention
Fig. 1 is a kind of networking schematic diagram of view networking of the application;
Fig. 2 is a kind of hardware structural diagram of node server of the application;
Fig. 3 is a kind of hardware structural diagram of access switch of the application;
Fig. 4 is that a kind of Ethernet association of the application turns the hardware structural diagram of gateway;
Fig. 5 is a kind of networking schematic diagram of the system of data timeout treatment of the embodiment of the present application;
Fig. 6 is a kind of step flow chart of the method for data timeout treatment of the embodiment of the present application;
Fig. 7 is a kind of structural block diagram of the device of data timeout treatment of the embodiment of the present application.
Specific embodiment
In order to make the above objects, features, and advantages of the present application more apparent, with reference to the accompanying drawing and it is specific realApplying mode, the present application will be further described in detail.
It is the important milestone of network Development depending on networking, is a real-time network, can be realized HD video real-time Transmission,Push numerous Internet applications to HD video, high definition is face-to-face.
Real-time high-definition video switching technology is used depending on networking, it can be such as high in a network platform by required serviceClear video conference, Intellectualized monitoring analysis, emergency command, digital broadcast television, delay TV, the Web-based instruction, shows video monitoringField live streaming, VOD program request, TV Mail, individual character records (PVR), Intranet (manages) channel by oneself, intelligent video Broadcast Control, information publicationAll be incorporated into a system platform etc. services such as tens of kinds of videos, voice, picture, text, communication, data, by TV orComputer realizes that high-definition quality video plays.
To make those skilled in the art more fully understand the embodiment of the present application, it is introduced below to depending on networking:
Depending on networking, applied portion of techniques is as described below:
Network technology (Network Technology)
Traditional ethernet (Ethernet) is improved depending on the network technology innovation networked, with potential huge on networkVideo flow.(Circuit is exchanged different from simple network packet packet switch (Packet Switching) or lattice networkSwitching), Streaming demand is met using Packet Switching depending on networking technology.Has grouping depending on networking technologyFlexible, the simple and low price of exchange, is provided simultaneously with the quality and safety assurance of circuit switching, it is virtually electric to realize the whole network switch typeThe seamless connection of road and data format.
Switching technology (Switching Technology)
Two advantages of asynchronous and packet switch that Ethernet is used depending on networking eliminate Ethernet under the premise of complete compatible and lackIt falls into, has the end-to-end seamless connection of the whole network, direct user terminal, directly carrying IP data packet.User data is in network-wide basisIt is not required to any format conversion.It is the more advanced form of Ethernet depending on networking, is a real-time exchange platform, can be realized at present mutuallyThe whole network large-scale high-definition realtime video transmission that networking cannot achieve pushes numerous network video applications to high Qinghua, unitizes.
Server technology (Server Technology)
It is different from traditional server, its Streaming Media depending on the server technology in networking and unified video platformTransmission be built upon it is connection-oriented on the basis of, data-handling capacity is unrelated with flow, communication time, single network layer energyEnough transmitted comprising signaling and data.For voice and video business, handled depending on networking and unified video platform Streaming MediaComplexity many simpler than data processing, efficiency substantially increase hundred times or more than traditional server.
Reservoir technology (Storage Technology)
The ultrahigh speed reservoir technology of unified video platform in order to adapt to the media content of vast capacity and super-flow andUsing state-of-the-art real time operating system, the programme information in server instruction is mapped to specific hard drive space, mediaContent is no longer pass through server, and moment is directly delivered to user terminal, and user waits typical time less than 0.2 second.It optimizesSector distribution greatly reduces the mechanical movement of hard disc magnetic head tracking, and resource consumption only accounts for the 20% of the internet ad eundem IP, butThe concurrent flow greater than 3 times of traditional disk array is generated, overall efficiency promotes 10 times or more.
Network security technology (Network Security Technology)
Depending on the structural design networked by servicing independent licence system, equipment and the modes such as user data is completely isolated every timeThe network security problem that puzzlement internet has thoroughly been eradicated from structure, does not need antivirus applet, firewall generally, has prevented blackThe attack of visitor and virus, structural carefree secure network is provided for user.
It services innovative technology (Service Innovation Technology)
Business and transmission are fused together by unified video platform, whether single user, private user or a netThe sum total of network is all only primary automatic connection.User terminal, set-top box or PC are attached directly to unified video platform, obtain richThe multimedia video service of rich colorful various forms.Unified video platform is traditional to substitute with table schema using " menu type "Complicated applications programming, considerably less code, which can be used, can be realized complicated application, realize the new business innovation of " endless ".
Networking depending on networking is as described below:
It is a kind of central controlled network structure depending on networking, which can be Tree Network, Star network, ring network etc. classType, but centralized control node is needed to control whole network in network on this basis.
As shown in Figure 1, being divided into access net and Metropolitan Area Network (MAN) two parts depending on networking.
The equipment of access mesh portions can be mainly divided into 3 classes: node server, access switch, terminal (including various machinesTop box, encoding board, memory etc.).Node server is connected with access switch, and access switch can be with multiple terminal phasesEven, and it can connect Ethernet.
Wherein, node server is the node that centralized control functions are played in access net, can control access switch and terminal.Node server can directly be connected with access switch, can also directly be connected with terminal.
Similar, the equipment of metropolitan area mesh portions can also be divided into 3 classes: metropolitan area server, node switch, node serveDevice.Metropolitan area server is connected with node switch, and node switch can be connected with multiple node servers.
Wherein, node server is the node server for accessing mesh portions, i.e. node server had both belonged to access wet endPoint, and belong to metropolitan area mesh portions.
Metropolitan area server is the node that centralized control functions are played in Metropolitan Area Network (MAN), can control node switch and node serveDevice.Metropolitan area server can be directly connected to node switch, can also be directly connected to node server.
It can be seen that be entirely a kind of central controlled network structure of layering depending on networking network, and node server and metropolitan areaThe network controlled under server can be the various structures such as tree-shaped, star-like, cyclic annular.
Visually claim, access mesh portions can form unified video platform (part in virtual coil), and multiple unified videos are flatPlatform can form view networking;Each unified video platform can be interconnected by metropolitan area and wide area depending on networking.
Classify depending on networked devices
1.1 the embodiment of the present application can be mainly divided into 3 classes: server depending on the equipment in networking, interchanger (including etherNet gateway), terminal (including various set-top boxes, encoding board, memory etc.).Depending on networking can be divided on the whole Metropolitan Area Network (MAN) (orNational net, World Wide Web etc.) and access net.
1.2 equipment for wherein accessing mesh portions can be mainly divided into 3 classes: node server, access switch (including etherNet gateway), terminal (including various set-top boxes, encoding board, memory etc.).
The specific hardware structure of each access network equipment are as follows:
Node server:
As shown in Fig. 2, mainly including Network Interface Module 201, switching engine module 202, CPU module 203, disk arrayModule 204;
Wherein, Network Interface Module 201, the Bao Jun that CPU module 203, disk array module 204 are come in enter switching engineModule 202;Switching engine module 202 look into the operation of address table 205 to the packet come in, to obtain the navigation information of packet;And the packet is stored according to the navigation information of packet the queue of corresponding pack buffer 206;If the queue of pack buffer 206 is closeIt is full, then it abandons;All pack buffer queues of 202 poll of switching engine mould, are forwarded: 1) port if meeting the following conditionsIt is less than to send caching;2) the queue package counting facility is greater than zero.Disk array module 204 mainly realizes the control to hard disk, includingThe operation such as initialization, read-write to hard disk;CPU module 203 is mainly responsible between access switch, terminal (not shown)Protocol processes, to address table 205 (including descending protocol packet address table, uplink protocol package address table, data packet addressed table)Configuration, and, the configuration to disk array module 204.
Access switch:
As shown in figure 3, mainly including Network Interface Module (downstream network interface module 301, uplink network interface module302), switching engine module 303 and CPU module 304;
Wherein, the packet (upstream data) that downstream network interface module 301 is come in enters packet detection module 305;Packet detection mouldWhether mesh way address (DA), source address (SA), type of data packet and the packet length of the detection packet of block 305 meet the requirements, if met,It then distributes corresponding flow identifier (stream-id), and enters switching engine module 303, otherwise abandon;Uplink network interface mouldThe packet (downlink data) that block 302 is come in enters switching engine module 303;The data packet that CPU module 204 is come in enters switching engineModule 303;Switching engine module 303 look into the operation of address table 306 to the packet come in, to obtain the navigation information of packet;If the packet into switching engine module 303 is that downstream network interface is gone toward uplink network interface, in conjunction with flow identifier(stream-id) packet is stored in the queue of corresponding pack buffer 307;If the queue of the pack buffer 307 is close full,It abandons;If the packet into switching engine module 303 is not that downstream network interface is gone toward uplink network interface, according to packetNavigation information is stored in the data packet queue of corresponding pack buffer 307;If the queue of the pack buffer 307 is close full,Then abandon.
All pack buffer queues of 303 poll of switching engine module, are divided to two kinds of situations in the embodiment of the present application:
If the queue is that downstream network interface is gone toward uplink network interface, meets the following conditions and be forwarded: 1)It is less than that the port sends caching;2) the queue package counting facility is greater than zero;3) token that rate control module generates is obtained;
If the queue is not that downstream network interface is gone toward uplink network interface, meets the following conditions and is forwarded:1) it is less than to send caching for the port;2) the queue package counting facility is greater than zero.
Rate control module 208 is configured by CPU module 204, to all downlink networks in programmable intervalInterface generates token toward the pack buffer queue that uplink network interface is gone, to control the code rate of forwarded upstream.
CPU module 304 is mainly responsible for the protocol processes between node server, the configuration to address table 306, and,Configuration to rate control module 308.
Ethernet association turns gateway:
As shown in figure 4, mainly including Network Interface Module (downstream network interface module 401, uplink network interface module402), switching engine module 403, CPU module 404, packet detection module 405, rate control module 408, address table 406, Bao HuanStorage 407 and MAC adding module 409, MAC removing module 410.
Wherein, the data packet that downstream network interface module 401 is come in enters packet detection module 405;Packet detection module 405 is examinedEthernet mac DA, ethernet mac SA, Ethernet length or frame type, the view networking mesh way address of measured data packetDA, whether meet the requirements depending on networking source address SA, depending on networking data Packet type and packet length, corresponding stream is distributed if meetingIdentifier (stream-id);Then, MAC DA, MAC SA, length or frame type are subtracted by MAC removing module 410(2byte), and enter corresponding receive and cache, otherwise abandon;
Downstream network interface module 401 detects the transmission caching of the port, according to the view of packet networking mesh if there is Bao ZeAddress D A knows the ethernet mac DA of corresponding terminal, adds the ethernet mac DA of terminal, Ethernet assists the MAC for turning gatewaySA, Ethernet length or frame type, and send.
The function that Ethernet association turns other modules in gateway is similar with access switch.
Terminal:
It mainly include Network Interface Module, Service Processing Module and CPU module;For example, set-top box mainly connects including networkMouth mold block, video/audio encoding and decoding engine modules, CPU module;Encoding board mainly includes Network Interface Module, video encoding engineModule, CPU module;Memory mainly includes Network Interface Module, CPU module and disk array module.
The equipment of 1.3 metropolitan area mesh portions can be mainly divided into 2 classes: node server, node switch, metropolitan area server.Wherein, node switch mainly includes Network Interface Module, switching engine module and CPU module;Metropolitan area server mainly includesNetwork Interface Module, switching engine module and CPU module are constituted.
2, networking data package definition is regarded
2.1 access network data package definitions
Access net data packet mainly include following sections: destination address (DA), source address (SA), reserve bytes,payload(PDU)、CRC。
As shown in the table, the data packet for accessing net mainly includes following sections:
Wherein:
Destination address (DA) is made of 8 bytes (byte), and first character section indicates type (such as the various associations of data packetDiscuss packet, multicast packet, unicast packet etc.), be up to 256 kinds of possibility, the second byte to the 6th byte is metropolitan area net address,Seven, the 8th bytes are access net address;
Source address (SA) is also to be made of 8 bytes (byte), is defined identical as destination address (DA);
Reserve bytes are made of 2 bytes;
The part payload has different length according to the type of different datagrams, is if it is various protocol packages64 bytes are 32+1024=1056 bytes if it is single group unicast packets words, are not restricted to above 2 kinds certainly;
CRC is made of 4 bytes, and calculation method follows the Ethernet CRC algorithm of standard.
2.2 Metropolitan Area Network (MAN) packet definitions
The topology of Metropolitan Area Network (MAN) is pattern, may there is 2 kinds, connection even of more than two kinds, i.e. node switching between two equipmentIt can all can exceed that 2 kinds between machine and node server, node switch and node switch, node switch and node serverConnection.But the metropolitan area net address of metropolitan area network equipment is uniquely, to close to accurately describe the connection between metropolitan area network equipmentSystem, introduces parameter in the embodiment of the present application: label, uniquely to describe a metropolitan area network equipment.
(Multi-Protocol Label Switch, multiprotocol label are handed over by the definition of label and MPLS in this specificationChange) label definition it is similar, it is assumed that between equipment A and equipment B there are two connection, then data packet from equipment A to equipment B justThere are 2 labels, data packet also there are 2 labels from equipment B to equipment A.Label is divided into label, outgoing label, it is assumed that data packet entersThe label (entering label) of equipment A is 0x0000, and the label (outgoing label) when this data packet leaves equipment A may reform into0x0001.The networking process of Metropolitan Area Network (MAN) is to enter network process under centralized control, also means that address distribution, the label of Metropolitan Area Network (MAN)Distribution be all to be dominated by metropolitan area server, node switch, node server be all passively execute, this point withThe label distribution of MPLS is different, and the distribution of the label of MPLS is the result that interchanger, server are negotiated mutually.
As shown in the table, the data packet of Metropolitan Area Network (MAN) mainly includes following sections:
| DA | SA | Reserved | Label | Payload | CRC |
That is destination address (DA), source address (SA), reserve bytes (Reserved), label, payload (PDU), CRC.ItsIn, the format of label, which can refer to, such as gives a definition: label is 32bit, wherein high 16bit retains, only with low 16bit, its positionSet is between the reserve bytes and payload of data packet.
Based on the above-mentioned characteristic of view networking, one of core idea of the embodiment of the present application is proposed, it then follows regard the association of networkingView, for same view networked clients, after receiving n-th data packet, using the first time threshold as the period, periodicallyGround detects whether to receive the N+1 data packet for carrying same identification marking, first carries out time-out record judgement, after just carry outJudgement is disconnected, can both disconnect in time connection when this is out of touch depending on networked clients in this way, discharges serverSystem pressure also can avoid causing to judge by accident depending on networked clients to this, cause to repeat to connect with this depending on networked clients to influence numberAccording to efficiency of transmission.
Embodiment 1:
As shown in figure 5, showing a kind of networking schematic diagram of the system of data timeout treatment of the embodiment of the present application, the systemSystem can be applied in view networking, and the view networking includes view networked server 01, be based on view with the view networked server 01Multiple view networked clients 02 of networking protocol connection.
It also can be considered the distributed data base frame based on view networking depending on networked server 01 mentioned by the embodiment of the present applicationFrame is distributed in each region of entire view networking, at most can access 255 view networked servers 01 in entire view networking.Each multiple view networked clients 02 that oneself place view intranet zone is managed depending on networked server 01, for example, view networking clothesCan be safeguarded in business device 01 it is managed enter netlist depending on networked clients 02, enter to have recorded in netlist and regard networked clients 02Number, title, addressable address etc. only carry out control tune depending on networked clients 02 to configured networking depending on networked server 01Degree.
It can be considered a kind of view networked hosts depending on networked clients 02, this can be an integrated view networking sound depending on networked hostsFrequently, the hardware and software device of the functions such as decoding video stream;It is also possible to a kind of data communication for supporting double nets (depending on networking, internet)Hardware and software device.Networking being regarded by view networking number access depending on networked terminals, (view in affiliated view networking network, which is networked, to be takenBusiness device 01), it is communicated with others depending on networked hosts etc..
Embodiment 2:
As shown in fig. 6, showing a kind of step flow chart of the method for data timeout treatment of the embodiment of the present application, the sideMethod can be applied in view networking, specifically can be applied in view networked server 01 shown in fig. 5, and the method specifically can be withThe following steps are included:
Step S601: the view networked server successively receives N number of data packet that view networked clients are sent;Wherein, N isPositive integer, the data packet carry the identification marking of the view networked clients;
Data mentioned by the embodiment of the present application, which can be, gives birth to depending on networked clients 02 according to the trigger action receivedAt, it is also possible to the data in other sources of forwarding.
Such as, in a kind of alternative embodiment of the application, provide a kind of data source mode, it is described depending on networking further include withThe first database 03 that the view networked clients 02 of network area where itself connect, the method specifically can also include followingStep:
N number of data packet is by the first database 03 generation when receiving the trigger action of data update;It is describedFirst database 03 is used to N number of data packet being sent to the view networked clients 02.Above-mentioned first database 03 can be withFor the MySQL database being connect with depending on networked clients 02.
It is described to be used to send out the data packet depending on networked clients 02 since above-mentioned first database 03 is located in internetBefore giving view networked server 01, the method is specifically further comprising the steps of:
It is described to be used to receive the internet that 03 internet protocol-based of first database is sent depending on networked clients 02Data packet;
It is described to be used to be based on depending on networked clients 02 that the internet data packet to be converted to view networking number depending on networking protocolAccording to packet.
Above-mentioned internet data packet is converted to the process of view networking data packet specifically: first disassembles packet header of data packet and interiorHold, the Internet protocol in packet header is removed, then will be added in packet header depending on networking protocol, and the data packet is sealed againDress, so as to form view networking data packet.
According to the level of current view networking, a view networked server 01 about can access 60000 view networked clients02, so view networked clients 02 are when sending data packet to view networked server 01, each data packet can carry describedDepending on the identification marking of networked clients 02, in order to identify depending on networked server 01 to received data packet, number is recordedAccording to source.Above-mentioned identification marking can be the MAC Address of view networked clients 02 or the account of view networking registration user.
In addition, since the transmission of data is propagated in the form of data flow after resolving into multiple data packets, so the applicationData packet in embodiment is preferably standard view networking data packet, and the standard regards networking data packet as 1024 bytes, with compared withThe transmission resolution speed of good adaptation view networking.
Step S602: it is described depending on networked server when receiving n-th data packet, record the n-th data packetIt stabs at the first time;
Due to being that data packet is sent to view networked server one by one in the form of data flow depending on networked clients 0201, the view networked server 01 and one by one received data packet, so just being recorded when often receiving a data packetThe receiving time of the data packet is stabbed.
Step S603: the view networked server judges the time difference of current time stamp and first time stamp;
Step S604: if the time difference is greater than preset first time threshold, the view networked server is with instituteStating first time threshold is the period, periodically detects and whether receives the N+1 data packet for carrying same identification marking;
Step S605: the view networked server is for detection every time, when not receiving the N+1 data packet,View networked clients corresponding with the identification marking are subjected to primary time-out record;
Step S606: when for it is described view networked clients time-out record number be greater than preset times threshold value or it is described whenBetween difference be greater than preset second time threshold, it is described to be disconnected with described depending on networked clients depending on networked server.
It is provided with overtime judgment module in depending on networked server 01, there is a timer in overtime judgment module, this is fixedWhen device/timer run as normal clock, show current time stamp all the time.
Due to being likely to be received the data packet that multiple view networked clients 02 are sent in synchronization depending on networked server 01,So by identification marking it may determine that the data source of the data packet.For same view networked clients 02, taken depending on networkingBusiness device 01 just stabs the receiving time of the data packet after N (N may be 1,2,3 ... N) a data packet for receiving its transmission(stab at the first time) is recorded, at the same calculate the time difference between current time stamp and at the first time stamp (can be regarded as fromStamp starts at the first time, and timer timing since 0, the time is longer, and the numerical value of timing is bigger on timer, i.e. time differenceAlso bigger), judge whether the time difference is greater than preset first time threshold and (can record once, or increase for timer is everyAs soon as adding numerical value, time difference and preset first time threshold judge primary), if difference has been more than presetTimeout interval (first time threshold), and do not receive the N+1 data packet of view networked clients transmission also at this time,Just it is believed that time out event has occurred, corresponding with the identification marking primary time-out record will be carried out depending on networked clients 02,Tentatively it is judged as that the view networked clients 02 are in data transmission unstable state.
Next, timer still lasting timing (i.e. since first time stab timing), then with described first whenBetween threshold value be the period, periodically detect and whether receive the N+1 data packet for carrying same identification marking.For example it is spacedA cycle does not receive the N+1 data packet, just carries out time-out for the first time to the view networked clients 02 and records;It is spaced second period, does not receive the N+1 data packet also, second of time-out just is carried out to the view networked clients 02Record ...
If being greater than preset times threshold value for the time-out record depending on networked clients 02 or the time difference being greater thanPreset second time threshold (second time threshold is much larger than first time threshold), then can determine that the view networked clients 02 are sent outRaw failure or network failure connected to it regard networked server 01 at this time and just actively disconnect and the view networked clients 02Connection, stop forwarding data to the view networked clients 02, and discharge the occupied resource of connection, current view can be relieved with thisThe pressure of networked server 01 is excessive, and system resource occupies excessively high problem.
For the step S603~step S606 of the embodiment of the present application, further illustrated using a specific example:
First time threshold is 2 seconds, and second time threshold is 30 seconds, and preset times threshold value is 16 times;
Regard networked server 01 receive the 1st data packet timestamp as 9:00, timer timing since 0 at this time, ifDetermine timer using the second as the unit of display, using millisecond as time of day, when timer is shown as 1.000 seconds, at this time and at the first timeThe time difference of stamp is 1 second, does not receive the 2nd data packet, time difference does not do any place again smaller than first time thresholdReason;When timer is shown as 2.000 seconds, it is at this time 2 seconds with the time difference of first time stamp, does not also receive the 2nd numberAccording to packet, time difference is equal to first time threshold, without any processing;But when the timer time is 2.001 seconds, at this time with theThe time difference of one timestamp is 2.001 seconds, does not also receive the 2nd data packet, and time difference is greater than first time threshold, willIt is corresponding with the identification marking to carry out primary time-out record depending on networked clients 02.Next, being taken at interval of two seconds depending on networkingWhether business device 01 receives the 2nd data packet under just detecting.When number of detection cycles is 15 times, i.e., join for the viewWhen the time-out record number of net client 01 is 15 times, the time difference has been 30 seconds at this time, so at 30.001 secondsWhen, it does not receive the 2nd data packet also at this time, will actively disconnect and connect with the view networked clients 02 depending on networked server 01It connects.
The embodiment of the present application is set as 1.5~3 seconds in an alternative embodiment, by first time threshold.It can avoid in this wayThe problem of timeout interval time sets too short, causes time-out record erroneous judgement depending on networked clients 02 to this;When also can avoid intervalBetween it is too long, to connect with depending on networked clients 02 network stabilization detection failure.
Meanwhile preset times threshold value is set as 16 times, the second time by the embodiment of the present application in another alternative embodimentThreshold value is set as 30 seconds~60 seconds.Threshold value setting is higher than 30 seconds, can preferably judge the net connecting with depending on networked clients 02Whether network is normal, avoids blindly disconnecting the connection with view networked clients 02;Threshold value is set lower than 60 seconds, avoids joining with the viewThe connection of net client 02 occupies the overlong time of view networked server 01, that is, avoids the system money for occupying view networked server 01The overlong time in source and running memory.
It is described depending on networking further include with second database 04 being connect depending on networked server 01, if regard the Internet servicesCommunication between device 01 and view networked clients 02 is normal, just forwards data packet after receiving data packet depending on networked server 01It is stored to the second database 04, in a preferred embodiment, specific pass-through mode can are as follows:
Step S607: it is described depending on networked server 01 when receiving n-th data packet, by the n-th data packet send outIt send into second database 04 and stores.
Above preferred embodiment shows a kind of mode of forwarding of data packet, is receiving one depending on networked server 01The data packet is just forwarded to the storage backup of the second database 04 when data packet, data packet can avoid with this and be deposited in view networking clothesIt is engaged in the interior the problem of occupying its memory of device 01, while can guarantee the integrality of data backup.Second database 03 is also to network with viewThe MySQL database that client 02 connects.
The embodiment of the present application elaborates data from the angle depending on networked server 01 by step S601~step S606A kind of possible mode of timeout treatment: being directed to same view networked clients 02, after receiving n-th data packet, with described theOne time threshold is the period, periodically detects and whether receives the N+1 data packet for carrying same identification marking, advancedRow time-out record judgement, after just turn off connection judgment, so both can be timely when the view networked clients 02 are out of touchConnection is disconnected, server system pressure is discharged, also can avoid that this is caused to judge by accident depending on networked clients 02, cause to repeatConnecting with this depending on networked clients 02 influences data transmission efficiency.
The data timeout treatment mechanism of the embodiment of the present application is different from traditional heartbeat inspecting mechanism, the embodiment of the present application withoutHeartbeat inspecting thread need to be individually established, heartbeat packet is sent or received or heartbeat frame to carry out heartbeat prison to view networked clients 02It surveys, heartbeat bag data can be reduced to the occupancy of the memory headroom of view networked server 01, reduce the operation of view networked server 01Pressure.
Meanwhile compared to traditional data transmission mechanism UDT, the data timeout treatment mechanism of the embodiment of the present application utilizes UDTPrinciple, not only overcome at present be not available UDT agreement view networking in transmit data the problem of, while also using view connectionThe data transmission security that the data transmission security of net compensates for UDT agreement is poor, is easy the problem of being stolen by others.
It should be noted that for simple description, therefore, it is stated as a series of action groups for embodiment of the methodIt closes, but those skilled in the art should understand that, the embodiment of the present application is not limited by the described action sequence, because according toAccording to the embodiment of the present application, some steps may be performed in other sequences or simultaneously.Secondly, those skilled in the art also shouldKnow, the embodiments described in the specification are all preferred embodiments, and related movement not necessarily the application is implementedNecessary to example.
Embodiment 3:
As shown in fig. 7, method described in corresponding embodiment 2, shows a kind of data timeout treatment of the embodiment of the present applicationThe structural block diagram of device, described device can be applied in view networking, specifically can be applied to the view networking clothes shown in fig. 5It is engaged in device 01, described to can specifically include depending on networked server 01 with lower module:
Packet-receiving module 701, the N number of data packet sent for successively receiving view networked clients;Wherein, N is positiveInteger, the data packet carry the identification marking of the view networked clients;
Stamp logging modle 702 at the first time, for when receiving n-th data packet, recording the n-th data packetIt stabs at the first time;
Time difference judgment module 703, for judging the time difference of current time stamp and first time stamp;
Periodicity detection module 704 is used for when the time difference is greater than preset first time threshold, then with describedFirst time threshold is the period, periodically detects and whether receives the N+1 data packet for carrying same identification marking;
Overtime logging modle 705, will be with institute when not receiving the N+1 data packet for detecting for eachIt states the corresponding view networked clients of identification marking and carries out primary time-out record;
Depending on networked clients management module 706, for being greater than for the time-out record number depending on networked clientsWhen preset times threshold value or the time difference are greater than preset second time threshold, disconnect and connecting with the view networked clientsIt connects.
Corresponding preferred embodiment of the present application, it is described to further include and second connect depending on networked server 01 depending on networkingDatabase 04, described specifically to be comprised the following modules depending on networked server 01:
Data packet forward module 707, for when receiving n-th data packet, the n-th data packet to be sent to instituteIt states and is stored in the second database 04.
The embodiment of the present application also provides a kind of devices, comprising:
One or more processors;With
One or more machine readable medias of instruction are stored thereon with, are executed when by one or more of processorsWhen, so that the method that described device executes one or more described in the embodiment of the present application.
The embodiment of the present application also provides one or more machine readable medias, are stored thereon with instruction, when by one orWhen multiple processors execute, so that the method that the processor executes one or more described in the embodiment of the present application.
For device embodiment, since it is basically similar to the method embodiment, related so being described relatively simplePlace illustrates referring to the part of embodiment of the method.
All the embodiments in this specification are described in a progressive manner, the highlights of each of the examples are withThe difference of other embodiments, the same or similar parts between the embodiments can be referred to each other.
It should be understood by those skilled in the art that, the embodiments of the present application may be provided as method, apparatus or calculatingMachine program product.Therefore, the embodiment of the present application can be used complete hardware embodiment, complete software embodiment or combine software andThe form of the embodiment of hardware aspect.Moreover, the embodiment of the present application can be used one or more wherein include computer canWith in the computer-usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) of program codeThe form of the computer program product of implementation.
The embodiment of the present application is referring to according to the method for the embodiment of the present application, terminal device (system) and computer programThe flowchart and/or the block diagram of product describes.It should be understood that flowchart and/or the block diagram can be realized by computer program instructionsIn each flow and/or block and flowchart and/or the block diagram in process and/or box combination.It can provide theseComputer program instructions are set to general purpose computer, special purpose computer, Embedded Processor or other programmable data processing terminalsStandby processor is to generate a machine, so that being held by the processor of computer or other programmable data processing terminal devicesCapable instruction generates for realizing in one or more flows of the flowchart and/or one or more blocks of the block diagramThe device of specified function.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing terminal devicesIn computer-readable memory operate in a specific manner, so that instruction stored in the computer readable memory generates packetThe manufacture of command device is included, which realizes in one side of one or more flows of the flowchart and/or block diagramThe function of being specified in frame or multiple boxes.
These computer program instructions can also be loaded into computer or other programmable data processing terminal devices, so thatSeries of operation steps are executed on computer or other programmable terminal equipments to generate computer implemented processing, thusThe instruction executed on computer or other programmable terminal equipments is provided for realizing in one or more flows of the flowchartAnd/or in one or more blocks of the block diagram specify function the step of.
Although preferred embodiments of the embodiments of the present application have been described, once a person skilled in the art knows basesThis creative concept, then additional changes and modifications can be made to these embodiments.So the following claims are intended to be interpreted asIncluding preferred embodiment and all change and modification within the scope of the embodiments of the present application.
Finally, it is to be noted that, herein, relational terms such as first and second and the like be used merely to byOne entity or operation are distinguished with another entity or operation, without necessarily requiring or implying these entities or operationBetween there are any actual relationship or orders.Moreover, the terms "include", "comprise" or its any other variant meaningCovering non-exclusive inclusion, so that process, method, article or terminal device including a series of elements not only wrapThose elements are included, but also including other elements that are not explicitly listed, or further includes for this process, method, articleOr the element that terminal device is intrinsic.In the absence of more restrictions, being wanted by what sentence "including a ..." limitedElement, it is not excluded that there is also other identical elements in process, method, article or the terminal device for including the element.
Method to a kind of data timeout treatment provided herein and a kind of device of data timeout treatment above, intoIt has gone and has been discussed in detail, specific examples are used herein to illustrate the principle and implementation manner of the present application, the above implementationThe explanation of example is merely used to help understand the present processes and its core concept;Meanwhile for the general technology people of this fieldMember, according to the thought of the application, there will be changes in the specific implementation manner and application range, in conclusion this explanationBook content should not be construed as the limitation to the application.