CN106375152A - Method for processing communication abnormality of Client/Server (C/S) architecture - Google Patents

Method for processing communication abnormality of Client/Server (C/S) architecture Download PDF

Info

Publication number
CN106375152A
CN106375152A CN201610799832.3A CN201610799832A CN106375152A CN 106375152 A CN106375152 A CN 106375152A CN 201610799832 A CN201610799832 A CN 201610799832A CN 106375152 A CN106375152 A CN 106375152A
Authority
CN
China
Prior art keywords
client
server
communication abnormality
framework
processing method
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201610799832.3A
Other languages
Chinese (zh)
Inventor
王松
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
JINAN TELETEST TECHNOLOGY Co Ltd
Original Assignee
JINAN TELETEST TECHNOLOGY Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by JINAN TELETEST TECHNOLOGY Co Ltd filed Critical JINAN TELETEST TECHNOLOGY Co Ltd
Priority to CN201610799832.3A priority Critical patent/CN106375152A/en
Publication of CN106375152A publication Critical patent/CN106375152A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0805Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
    • H04L43/0811Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking connectivity

Landscapes

  • Engineering & Computer Science (AREA)
  • Environmental & Geological Engineering (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)

Abstract

The present invention relates to a method for processing a communication abnormality of a Client/Server (C/S) architecture. The method comprises the following steps that a server sends device state information to a client in real time; the client sends permission authentication information to the server in real time; the server and the client monitor and count the data sent by the other side in real time; and the server and the client detect whether a sending frequency of the other side is within a set time threshold, wherein if the detected sending frequency is beyond the set time threshold, it is determined that corresponding socket connection is abnormal, and then the socket is disconnected. Through adoption of the method, when two communication sides have no invalid data transmission, abnormal disconnection of the network is processed in time, and the method has high practicability.

Description

A kind of communication abnormality processing method of c/s framework
Technical field
The invention belongs to network communication technology field, more particularly, to a kind of communication abnormality processing method of c/s framework.
Background technology
In recent years, smart mobile phone has become as the important component part in people's life and work, and it changes user to product The use habit of product.Along with the development of radio communication, mobile phone terminal can manage control any can be with the product in access network Product, such as household electrical appliances, switch, monitoring device etc., the new industry such as smart home, the Internet is in Fast Growth.Equally, this also forces Test instrunment industry, to product up-gradation, operates data result observation etc. by mobile phone terminal to testing equipment.
C/s framework is commonly used to meet the demand of above-mentioned application scenarios, and that is, test equipment is as server (server), The client (client) of the different platforms such as android, ios, windows is led to by wired or wireless network and equipment Letter, consults to control or inquiry operation through procotol.In c/s network service, client and server both sides pass through corresponding Web socket (socket) is communicated, and both sides' program need to timely respond to connect the abnormal disconnection of socket, thus entering Row network disconnection process or reconnection operation, that is, while not affecting normal use communication it is ensured that abnormal disconnect, connecting moves Stationarity, vigorousness.
Socket, is exactly briefly a kind of agreement of communicating pair, is completed with the correlation function in socket to communicate Process.When application layer enters row data communication by transport layer, tcp and udp can run into be provided for multiple program process simultaneously The problem of concurrent services.Multiple tcp connect or multiple program process may need to transmit by same tcp protocol port Data.In order to distinguish different program process and connection, many computer operating systems are that application program is assisted with tcp/ip View interaction provides the interface of referred to as socket (socket).Distinguish the network service between different application process and connection, Mainly there are 3 parameters: the purpose ip address of communication, the transport layer protocol (tcp or udp) using and the port numbers using.One The a lot of client of server correspondence connects, and server must safeguard that a client connects list, often increases a client and connects Server end will a newly-built socket be responsible for being engaged in the dialogue with newly-increased client communicating.
In prior art, server and client side utilizes application protocol, realizes special heartbeat message, both sides are right Answer receiving terminal that heartbeat message is monitored, when receiving message amount, frequency fail to meet communication connection holding when requiring, judge Disconnect for Network Abnormal, process is turned off to socket.Because it is processed frequently, both took the network bandwidth, be unable to shape again Become effective application data.Server end often accesses multiple client, makes developer can not ignore redundant data transmission right The pressure that the network bandwidth and computing take.
Content of the invention
For the deficiency of prior art, the invention provides a kind of communication abnormality processing method of c/s framework, it include with Lower step:
S1) server sends status information of equipment in real time to client;
S2) client real-time sending permission checking information is to server;
S3) the server and client side's data that sends real-time to other side carries out monitoring counting;
S4) whether server and client side detects the transmission frequency of other side in the threshold timeframe setting;
S5) if the transmission frequency detecting exceedes the threshold time of setting, that is, judge that corresponding socket connects appearance Abnormal, carry out socket disconnection process.
According to a preferred implementation, in step s1, server is to all clients broadcast transmitting apparatus information report Literary composition, the content of described facility information message be the status information of uploading device to client so that client can be known immediately The state of far-end.
According to a preferred implementation, the frequency that described server sends described facility information message is 0.5~2 second.
According to a preferred implementation, described client parses to the described facility information message receiving, and The time interval receiving message is calculated;If it exceeds the first threshold time setting, that is, judge that corresponding socket connects Abnormal, closing process is carried out to client socket, disconnects from server end.The described first threshold time range setting is as 4 ~8 seconds.
According to a preferred implementation, in step s2, user end to server sending permission checking information, described power The content of limit checking information is to obtain the remotely control authority of server or to the confirmation obtaining authority.
According to a preferred implementation, the frequency that described client sends described Authority Verification information is 0.5~2 second.
According to a preferred implementation, server carries out protocol analysis to the described Authority Verification information receiving, and right The time interval receiving message is calculated, if it exceeds the Second Threshold time setting, that is, judges that corresponding socket connects different Often, closing process is carried out to server side socket, and corresponding client is deleted from access client side list.Described set Fixed Second Threshold time range is 4~8 seconds.
The present invention has following Advantageous Effects:
Server sends status information of equipment in real time to client, and client real-time sending permission checking information gives service Device.And, both sides' send data real-time to other side carries out monitoring counting, detects whether its transmission frequency meets network connection normal Requirement, with this judge socket connect whether there is exception.If there is exception, that is, carry out socket disconnection process.Communication Both sides are not while having invalid data transfer, you can process Network Abnormal disconnection in time.
Brief description
Fig. 1 is the flow chart of an embodiment of the invention;
Fig. 2 is the flow chart of another embodiment of the invention;
Fig. 3 is the communication scheme of server and client in the present invention.
Specific embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, complete Site preparation illustrates, described embodiment is only the section Example of the present invention, rather than whole embodiments.Based in the present invention Embodiment, the every other embodiment that those skilled in the art are obtained, broadly fall into the scope of protection of the invention.
As shown in figure 1, the communication abnormality processing method of c/s framework comprises the following steps:
S1) server sends status information of equipment in real time to client;
S2) client real-time sending permission checking information is to server;
S3) the server and client side's data that sends real-time to other side carries out monitoring counting;
S4) whether server and client side detects the transmission frequency of other side in the threshold timeframe setting;
S5) if the transmission frequency detecting exceedes the threshold time of setting, that is, judge that corresponding socket connects appearance Abnormal, carry out socket disconnection process.
In step s1, server is to all clients broadcast transmitting apparatus infomational message, the content of facility information message For uploading device status information to client so that client can know the state of far-end immediately.Server sends equipment The frequency of infomational message is 0.5~2 second.
Client parses to the facility information message receiving, and the time interval receiving message is calculated. If it exceeds the first threshold time setting, that is, judge that corresponding socket connects abnormal, client socket is carried out at closing Reason, disconnects from server end.The first threshold time range setting is usually 4~8 seconds, and it can be according to the needs of different application Set or adjusted.
In step s2, user end to server sending permission checking information, the content of Authority Verification information is to obtain clothes Business device remotely control authority or to the confirmation obtaining authority.The frequency of client sending permission checking information is 0.5~2 Second.
Server carries out protocol analysis to the Authority Verification information receiving, and the time interval receiving message is counted Calculate.If it exceeds the Second Threshold time setting, that is, judge that corresponding socket connects abnormal, server side socket is closed Close process, and corresponding client is deleted from access client side list.The Second Threshold time range setting as 4~8 seconds, And it can be set according to the needs of different application or be adjusted.
It should be noted that the present invention is simultaneously unrestricted to the sequencing of step s1 and step s2, i.e. the present invention also may be used It is operated in the way of illustrating according to Fig. 2.
As shown in figure 3, multiple client access server carries out network service.After network both sides' socket successful connection, I.e. to server sending permission checking information message, content is to obtain the remotely control authority of server or to obtaining to client The confirmation of weighting limit, the transmission frequency of message is 1s.Server end carries out protocol analysis to receiving Authority Verification information, and to receipts Time interval to message is calculated, if it exceeds the Second Threshold time (5s) setting, that is, judges that corresponding socket is abnormal, Server side socket closing is processed, and this client is deleted from access client side list.It should be noted that Fig. 3 Illustrate only the schematic diagram that server is communicated, practical situation not limited to this with a client, server can be with other Multiple client is communicated.
Similarly, to all clients broadcast transmitting apparatus infomational message, content is the state letter of uploading device to server Cease to client, enable client immediately to know the state of far-end, the transmission frequency of message is also 1s.Client is to receiving equipment Infomational message carries out protocol analysis, and equipment state is shown in user interface, and the time interval receiving message is carried out Calculate, if it exceeds the first threshold time (5s) setting, that is, judge that corresponding socket is abnormal, at client socket closing Reason, disconnects from server end.
Using technical scheme, because communicating pair will not consult special heartbeat message, therefore process simple, Take the network bandwidth little.Communicating pair is not while having invalid data transfer, you can processes Network Abnormal in time and disconnects feelings Condition, has good practicality.
It should be noted that above-mentioned specific embodiment is exemplary, those skilled in the art can be open in the present invention Find out various solutions under the inspiration of content, and these solutions also belong to disclosure of the invention scope and fall into this Within bright protection domain.It will be understood by those skilled in the art that description of the invention and its accompanying drawing be illustrative and not Constitute limitations on claims.Protection scope of the present invention is limited by claim and its equivalent.

Claims (9)

1. a kind of communication abnormality processing method of c/s framework is it is characterised in that comprise the following steps:
S1) server sends status information of equipment in real time to client;
S2) client real-time sending permission checking information is to server;
S3) the server and client side's data that sends real-time to other side carries out monitoring counting;
S4) whether server and client side detects the transmission frequency of other side in the threshold timeframe setting;
S5) if the transmission frequency detecting exceedes the threshold time of setting, that is, judge that corresponding socket connects appearance extremely, Carry out socket disconnection process.
2. the communication abnormality processing method of c/s framework as claimed in claim 1 is it is characterised in that in step s1, server To all clients broadcast transmitting apparatus infomational message, the content of described facility information message is that the status information of uploading device is given Client, so that client can know the state of far-end immediately.
3. the communication abnormality processing method of c/s framework as claimed in claim 2 is it is characterised in that described server sends institute The frequency stating facility information message is 0.5~2 second.
4. the communication abnormality processing method of c/s framework as claimed in claim 3 is it is characterised in that described client is to receiving Described facility information message parsed, and the time interval receiving message is calculated;If it exceeds set the One threshold time, that is, judge that corresponding socket connects abnormal, carry out closing process to client socket, break from server end Open.
5. the communication abnormality processing method of c/s framework as claimed in claim 4 is it is characterised in that the first threshold of described setting Value time range is 4~8 seconds.
6. the communication abnormality processing method of c/s framework as claimed in claim 1 is it is characterised in that in step s2, client To server sending permission checking information, the content of described Authority Verification information be obtain server remotely control authority or To the confirmation obtaining authority.
7. the communication abnormality processing method of c/s framework as claimed in claim 6 is it is characterised in that described client sends institute The frequency stating Authority Verification information is 0.5~2 second.
8. the communication abnormality processing method of c/s framework as claimed in claim 7 is it is characterised in that server is to the institute receiving State Authority Verification information and carry out protocol analysis, and the time interval receiving message is calculated, if it exceeds set second Threshold time, that is, judge that corresponding socket connects abnormal, carry out closing process to server side socket, and by corresponding client End is deleted from access client side list.
9. the communication abnormality processing method of c/s framework as claimed in claim 8 is it is characterised in that the second threshold of described setting Value time range is 4~8 seconds.
CN201610799832.3A 2016-08-31 2016-08-31 Method for processing communication abnormality of Client/Server (C/S) architecture Pending CN106375152A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610799832.3A CN106375152A (en) 2016-08-31 2016-08-31 Method for processing communication abnormality of Client/Server (C/S) architecture

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610799832.3A CN106375152A (en) 2016-08-31 2016-08-31 Method for processing communication abnormality of Client/Server (C/S) architecture

Publications (1)

Publication Number Publication Date
CN106375152A true CN106375152A (en) 2017-02-01

Family

ID=57900234

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610799832.3A Pending CN106375152A (en) 2016-08-31 2016-08-31 Method for processing communication abnormality of Client/Server (C/S) architecture

Country Status (1)

Country Link
CN (1) CN106375152A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108334416A (en) * 2018-01-08 2018-07-27 千寻位置网络有限公司 Automatic verification method is acquired for the sampling for broadcasting data
CN110320895A (en) * 2019-08-01 2019-10-11 北京百度网讯科技有限公司 A kind of fault detection method and device, vehicle
CN110365667A (en) * 2019-07-03 2019-10-22 杭州迪普科技股份有限公司 Attack message means of defence, device, electronic equipment
CN110875859A (en) * 2018-09-04 2020-03-10 北京京东尚科信息技术有限公司 Method and system for monitoring network connection abnormity
CN112737890A (en) * 2020-12-29 2021-04-30 上海微波技术研究所(中国电子科技集团公司第五十研究所) Method and system for preventing network tester from being interrupted due to network oscillation
CN113055921A (en) * 2021-03-29 2021-06-29 中国联合网络通信集团有限公司 Fault processing method and terminal

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101420770A (en) * 2008-12-03 2009-04-29 浙江中控软件技术有限公司 Fault connection processing method and system in wireless transmission
CN101459881A (en) * 2007-12-12 2009-06-17 中国移动通信集团公司 Message bearing method and customer terminal, message server
CN103873472A (en) * 2014-03-18 2014-06-18 广州市纬志电子科技有限公司 Method for automatically having access to network
EP2790382A1 (en) * 2012-09-17 2014-10-15 Huawei Technologies Co., Ltd. Protection method and device against attacks
US20140330891A1 (en) * 2013-05-03 2014-11-06 Khader Basha P.R. Virtual desktop accelerator with support for dynamic proxy thread management

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101459881A (en) * 2007-12-12 2009-06-17 中国移动通信集团公司 Message bearing method and customer terminal, message server
CN101420770A (en) * 2008-12-03 2009-04-29 浙江中控软件技术有限公司 Fault connection processing method and system in wireless transmission
EP2790382A1 (en) * 2012-09-17 2014-10-15 Huawei Technologies Co., Ltd. Protection method and device against attacks
US20140330891A1 (en) * 2013-05-03 2014-11-06 Khader Basha P.R. Virtual desktop accelerator with support for dynamic proxy thread management
CN103873472A (en) * 2014-03-18 2014-06-18 广州市纬志电子科技有限公司 Method for automatically having access to network

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108334416A (en) * 2018-01-08 2018-07-27 千寻位置网络有限公司 Automatic verification method is acquired for the sampling for broadcasting data
CN108334416B (en) * 2018-01-08 2021-05-04 千寻位置网络有限公司 Sampling acquisition automatic verification method for broadcast data
CN110875859A (en) * 2018-09-04 2020-03-10 北京京东尚科信息技术有限公司 Method and system for monitoring network connection abnormity
CN110365667A (en) * 2019-07-03 2019-10-22 杭州迪普科技股份有限公司 Attack message means of defence, device, electronic equipment
CN110320895A (en) * 2019-08-01 2019-10-11 北京百度网讯科技有限公司 A kind of fault detection method and device, vehicle
CN112737890A (en) * 2020-12-29 2021-04-30 上海微波技术研究所(中国电子科技集团公司第五十研究所) Method and system for preventing network tester from being interrupted due to network oscillation
CN113055921A (en) * 2021-03-29 2021-06-29 中国联合网络通信集团有限公司 Fault processing method and terminal
CN113055921B (en) * 2021-03-29 2022-09-23 中国联合网络通信集团有限公司 Fault processing method and terminal

Similar Documents

Publication Publication Date Title
CN106375152A (en) Method for processing communication abnormality of Client/Server (C/S) architecture
CN106571977B (en) Data transmission method and device
WO2016112642A1 (en) Method and apparatus for monitoring intelligent device
CN104506886B (en) A kind of fault handling method and cloud server
CN108255646A (en) A kind of self-healing method of industrial control program failure based on heartbeat detection
CN101448277B (en) Method, system and device for processing wireless access network faults
WO2019200944A1 (en) Physical intrusion attack detection method for industrial control system based on serial communication bus signal analysis
EP2755416B1 (en) Method and apparatus for remotely locating wireless network fault
CN109067763A (en) Safety detection method, equipment and device
CN103259699B (en) Method of testing, system and client and service end
CN107360239A (en) A kind of client connection status detection method and system
CN103763695B (en) Method for evaluating safety of internet of things
CN106850796B (en) Wireless tracking monitoring method and system based on Internet of things
CN106506277A (en) Communication means, communicator and home appliance
CN108566405A (en) Method for monitoring state, device and the storage medium of Medical Devices
CN108848448A (en) A kind of wireless network fault diagnosis system and method
CN107872364A (en) A kind of monitoring method of router state, apparatus and system
CN105988406A (en) Household monitoring equipment management system
CN110311970A (en) A kind of remote debugging system and its method
CN103001822B (en) The processing method of Network Abnormal and device
Mai et al. IEC 60870-5-104 network characterization of a large-scale operational power grid
KR20090045534A (en) Apparatus and method for obstacle sensing of network equipment by log filtering and system thereof
CN103516532A (en) Real-time warning system and method
Rinaldi et al. Softwarization of SCADA: lightweight statistical SDN-agents for anomaly detection
CN105163336A (en) Method and system for optimizing stability of wireless network

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20170201

RJ01 Rejection of invention patent application after publication