Movatterモバイル変換


[0]ホーム

URL:


CN106603633A - Connection establishing method and server - Google Patents

Connection establishing method and server
Download PDF

Info

Publication number
CN106603633A
CN106603633ACN201611063095.7ACN201611063095ACN106603633ACN 106603633 ACN106603633 ACN 106603633ACN 201611063095 ACN201611063095 ACN 201611063095ACN 106603633 ACN106603633 ACN 106603633A
Authority
CN
China
Prior art keywords
client
threshold value
connection
server
rate parameter
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
CN201611063095.7A
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.)
Shanghai Feixun Data Communication Technology Co Ltd
Original Assignee
Shanghai Feixun Data Communication 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 Shanghai Feixun Data Communication Technology Co LtdfiledCriticalShanghai Feixun Data Communication Technology Co Ltd
Priority to CN201611063095.7ApriorityCriticalpatent/CN106603633A/en
Publication of CN106603633ApublicationCriticalpatent/CN106603633A/en
Pendinglegal-statusCriticalCurrent

Links

Classifications

Landscapes

Abstract

The invention discloses a connection establishing method. The method includes steps: S100, determining whether a client initiates a connection request; S200, if yes, determining whether the current access amount of the client reaches a preset threshold, wherein the threshold is less than the total quantity of the clients; if yes, executing step S300; and if not, executing step S400; S300, receiving the connection request of the client after waiting for a preset duration, and establishing the connection with the client; and S400, receiving the connection request of the client, and establishing the connection with the client. According to the method, the starting time of the period of keep-alive messages is slowed, the condition that when a lot of clients are connected with a server at the same time, the server simultaneously sends the keep-alive messages so that the utilization rate of the downlink bandwidth of the server is not unequal is avoided, and the network burden can be effectively relieved.

Description

A kind of connection establishment method and server
Technical field
The present invention relates to the communications field, more particularly to a kind of connection establishment method and server.
Background technology
With the development of smart home, increasing equipment needs to be linked into server, in order to be able to keep with serverReal-time Communication for Power, most of equipment keep being connected all by the way of long connection with server.Typically can between equipment and serverTiming sends keep Alive Packet is whether KeepAlive messages are online to detect both sides.
When the quantity for being linked into server apparatus is increasing, the quantity of the KeepAlive messages that server sends also canLinear increase, when just startup due to server, has large number quipments in same time period access server, rear extended meeting cycleProperty ground send KeepAlive messages and carry out the presence of detecting devices to equipment, because equipment turn-on time compares concentration, thereforeThe periodicity that KeepAlive messages send is also relatively strong, so as to cause the downlink bandwidth utilization rate of server not perfectly flat.
The content of the invention
To solve above-mentioned technical problem, the present invention provides a kind of connection establishment method and server, can be by controlThe time that socket sets up slows down the initial time in keep Alive Packet cycle with this, so that server issues the time of keep Alive PacketAveragely, network burden is mitigated.
The technical scheme that the present invention is provided is as follows:
The invention discloses a kind of connection establishment method, including step:S100, determine whether client initiate connection pleaseAsk;S200, when have client initiate connection request when, judge whether current client access amount reaches predetermined threshold value;It is describedPredetermined threshold value is less than client total quantity;If so, execution step S300;Otherwise, execution step S400;When S300, wait are defaultThe connection request of client is received after length, the connection with client is set up;S400, the connection request for receiving client, set upWith the connection of client.
The present invention first carries out judging whether active client access amount reaches default threshold when client initiates connection requestValue, only can just receive the connection request of client when client access amount is not up to predetermined threshold value, set up and clientConnection, so as to control the setup time of socket, with this initial time in keep Alive Packet cycle can be slowed down, it is to avoid the same timeDuring a large amount of client connection servers, the server same time sends keep Alive Packet, causes the downlink bandwidth utilization rate of serverInequality, therefore the present invention can effectively mitigate network burden.
It is further preferred that also including step before step S100:S010, with the preset duration as the cycle updateClient access amount in each described preset duration.
Timing of the invention updates the client access amount in each preset duration, for avoiding in each preset duration simultaneouslyExcessive client is accessed, causes the initial time in the cycle of keep Alive Packet transmission identical.
It is further preferred that also including step before step S100:S020, execution initialization program, obtain describedPredetermined threshold value.
It is further preferred that step S020 further includes step:S021, original Accept functions are changedWrite, default access rate parameter is increased in the original Accept functions, and the default access rate parameter is set;S022, the predetermined threshold value is obtained according to the default access rate parameter.
It is further preferred that the default access rate parameter and the predetermined threshold value are calculated as follows;R=N/T;Y=R*S;Wherein, R represents default access rate parameter, and N represents client total quantity, and T represents the keep Alive Packet cycle, and Y represents pre-If threshold value, S represents preset duration.
The invention also discloses a kind of server, including:Request judge module, for determining whether that client is initiated to connectConnect request;Access amount judge module, for when there is client to initiate connection request, whether judging current client access amountReach predetermined threshold value;The predetermined threshold value is less than client total quantity;Connection establishment module, for waiting being followed by for preset durationThe connection request of client is received, the connection with client is set up;And the connection request of reception client, set up and clientConnection.
It is further preferred that also including:Counting module is updated, for updating described in each as the cycle with the preset durationClient access amount in preset duration.
It is further preferred that also including:Acquisition module, for performing initialization program, obtains the predetermined threshold value.
It is further preferred that the acquisition module is further included:Function setup submodule, for original Accept lettersNumber is rewritten, and default access rate parameter is increased in the original Accept functions, and arranges the default access rateParameter;Calculating sub module, for obtaining the predetermined threshold value according to the default access rate parameter.
It is further preferred that the default access rate parameter and the predetermined threshold value are calculated as follows;R=N/T;Y=R*S;Wherein, R represents default access rate parameter, and N represents client total quantity, and T represents the keep Alive Packet cycle, and Y represents pre-If threshold value, S represents preset duration.
Compared with prior art, the present invention first carries out judging active client access amount when client initiates connection requestPredetermined threshold value whether is reached, the connection request of client only can be just received when client access amount is not up to predetermined threshold value,Set up and the connection of client, so as to control the setup time of socket, with this can slow down the keep Alive Packet cycle it is initial whenBetween, it is to avoid during same time a large amount of client connection servers, the server same time sends keep Alive Packet, causes serverDownlink bandwidth utilization rate is unequal, therefore the present invention can effectively mitigate network burden.
Description of the drawings
Below by clearly understandable mode, preferred embodiment is described with reference to the drawings, the present invention is given furtherlyIt is bright.
Fig. 1 is a kind of key step schematic diagram of connection establishment method of the invention;
Fig. 2 is a kind of flow chart of connection establishment method of the invention;
Fig. 3 is a kind of main composition schematic diagram of server of the invention;
Fig. 4 is that a kind of server of the invention is fully composed schematic diagram.
Drawing reference numeral explanation:
100th, judge module is asked, 200, access amount judge module, 300, connection establishment module, 400, update count moduleBlock, 500, acquisition module, 510, function setup submodule, 520, calculating sub module.
Specific embodiment
In order to be illustrated more clearly that the embodiment of the present invention or technical scheme of the prior art, below by control description of the drawingsThe specific embodiment of the present invention.It should be evident that drawings in the following description are only some embodiments of the present invention, forFor those of ordinary skill in the art, on the premise of not paying creative work, can be obtaining other according to these accompanying drawingsAccompanying drawing, and obtain other embodiments.
To make simplified form, part related to the present invention is only schematically show in each figure, they are not representedIts practical structures as product.In addition, so that simplified form is readily appreciated, with identical structure or function in some figuresPart, only symbolically depicts one of those, or has only marked one of those.Herein, " one " is not only represented" only this ", it is also possible to represent the situation of " more than one ".
Fig. 1 is a kind of key step schematic diagram of connection establishment method of the invention, as shown in figure 1, a kind of connection establishment sideMethod, including step:S100, determine whether client initiate connection request;S200, when have client initiate connection request when,Judge whether current client access amount reaches predetermined threshold value;The predetermined threshold value is less than client total quantity;If so, performStep S300;Otherwise, execution step S400;S300, the connection request for waiting reception client after preset duration, set up and visitorThe connection at family end;S400, the connection request for receiving client, set up the connection with client.
Specifically, in linux system, a Socket only one of which KeepAlive cycle time parameter, i.e. serverThe period distances for being sent to the KeepAlive messages of all of client are identicals, and initial time is when being exactly the access of equipmentBetween.It is of the invention first to carry out judging whether active client access amount reaches predetermined threshold value when client initiates connection request, onlyHaving can just receive the connection request of client when client access amount is not up to predetermined threshold value, set up the connection with client,So as to control the setup time of socket, the initial time in keep Alive Packet cycle can be slowed down with this, it is to avoid the same time is a large amount ofDuring client connection server, the server same time sends keep Alive Packet, causes the downlink bandwidth utilization rate of server uneven, therefore the present invention can effectively mitigate network burden.
Preferably, step is also included before step S100:S010, update each institute by the cycle of the preset durationState the client access amount in preset duration.
Specifically, present invention timing updates the client access amount in each preset duration, during for avoiding each defaultAccess excessive client in length simultaneously, cause the initial time in the cycle of keep Alive Packet transmission identical.
Preferably, step is also included before step S100:S020, execution initialization program, obtain the default thresholdValue.
Predetermined threshold value is user according to real network situation self-defining in the present invention, for receiving client transmission companyAs the standard for judging when connecing request, as long as predetermined threshold value is less than client total quantity, you can reduce part client socketSetup time, so as to slow down the initial time in keep Alive Packet cycle.
Preferably, step S020 further includes step:S021, original Accept functions are rewritten, in instituteState and increase in original Accept functions default access rate parameter, and the default access rate parameter is set;S022, according to instituteState default access rate parameter and obtain the predetermined threshold value.
Specifically, the process that socket three-way handshakes are set up is as follows:
A. user end to server sends a SYN J
B. server is to one SYN K of client end response, and SYN J are carried out to confirm ACK J+1
C. user end to server sends a confirmation ACK K+1
Client call Connect functions initiate three-way handshake, and server is then blocked in Accept functions here, from stepAccept functions are constantly in blocked state between B to C, until receiving step C in ACK be just that Socket completes to buildIt is vertical.The present invention is improved to Accept functions so that Accept functions can be supported to arrange default access rate parameter, i.e., oftenSecond, maximum client accessed the parameter of quantity.In Linux, original Accept function prototypes are as follows:
int accept(int sockfd,struct sockaddr*addr,socklen_t*addrlen);
Wherein sockfd is the socket of socket, and addr is the address data structure of client.The present invention is by this letterNumber is improved to int accept (int sockfd, struct sockaddr*addr, int accept_rate, socklen_t*addrlen);Default access rate parameter int accept_rate is increased, the effect of the default access rate parameter is controlThe speed that client is accessed, i.e. how many clients of access per second.
The present invention presets access rate parameter by increasing, when can know default according to the default access rate parameterThe predetermined threshold value for accessing client is allowed in long.
Preferably, the default access rate parameter and the predetermined threshold value are calculated as follows;R=N/T;Y=R*S;Wherein, R represents default access rate parameter, and N represents client total quantity, and T represents the keep Alive Packet cycle, and Y represents default thresholdValue, S represents preset duration.
The keep Alive Packet cycle for assuming server is T, has N platform client devices to be connected to server, then preset and access speedRate parameter is then N/T, and according to N/T speed client is accessed, then the predetermined threshold value that access client is allowed in preset duration is thenS*N/T, and it is preferred, and ideally, the time point of this N platform equipment access server is generally evenly distributed in the keep Alive Packet cycleIn T, i.e., preset duration is 1 second, then the quantity of access server per second is N/T platforms.
Fig. 2 is a kind of flow chart of connection establishment method of the invention.As shown in Fig. 2 the workflow of the present invention is as follows:
20th, start.
21st, determine whether that client initiates connection request;If so, next step is performed;Otherwise execution step 21;
22nd, judge whether current client access amount reaches predetermined threshold value;If so, execution step 23;Otherwise, step is performedRapid 24.
23rd, the connection request that client is received after preset duration is waited, the connection with client is set up.
24th, the connection request of client is received, the connection with client is set up.
Fig. 3 is a kind of main composition schematic diagram of server of the invention.As shown in figure 3, a kind of server, including:RequestJudge module 100, for determining whether that client initiates connection request;Access amount judge module 200, has client for working asWhen initiating connection request, judge whether current client access amount reaches predetermined threshold value;The predetermined threshold value is less than clientTotal quantity;Connection establishment module 300, for waiting preset duration after receive client connection request, set up and clientConnection;And the connection request of reception client, set up the connection with client.
The present invention first carries out judging whether active client access amount reaches default threshold when client initiates connection requestValue, only can just receive the connection request of client when client access amount is not up to predetermined threshold value, set up and clientConnection, so as to control the setup time of socket, with this initial time in keep Alive Packet cycle can be slowed down, it is to avoid the same timeDuring a large amount of client connection servers, the server same time sends keep Alive Packet, causes the downlink bandwidth utilization rate of serverInequality, therefore the present invention can effectively mitigate network burden.
Fig. 4 is that a kind of server of the invention is fully composed schematic diagram.As shown in Figure 4, it is preferred that also include:Update meterDigital-to-analogue block 400, for updating the client access amount in each described preset duration as the cycle with the preset duration.
Counting module 400 is updated in the present invention first to reset in initialization, then records the client's termination in preset durationEnter amount, while when next preset duration arrives, removing the client access amount of previous preset duration.
Preferably, as shown in figure 4, also including:Acquisition module 500, for performing initialization program, obtains the default thresholdValue.
Predetermined threshold value is user according to real network situation self-defining in the present invention, for receiving client transmission companyAs the standard for judging when connecing request, as long as predetermined threshold value is less than client total quantity, you can reduce part client socketSetup time, so as to slow down the initial time in keep Alive Packet cycle.
Preferably, the acquisition module 500 is further included:Function setup submodule 510, for original Accept lettersNumber is rewritten, and default access rate parameter is increased in the original Accept functions, and arranges the default access rateParameter;Calculating sub module 520, for obtaining the predetermined threshold value according to the default access rate parameter.
Preferably, the default access rate parameter and the predetermined threshold value are calculated as follows;R=N/T;Y=R*S;Wherein, R represents default access rate parameter, and N represents client total quantity, and T represents the keep Alive Packet cycle, and Y represents default thresholdValue, S represents preset duration.
The keep Alive Packet cycle for assuming server is T, has N platform client devices to be connected to server, then preset and access speedRate parameter is then N/T, and according to N/T speed client is accessed, then the predetermined threshold value that access client is allowed in preset duration is thenS*N/T, and it is preferred, and ideally, the time point of this N platform equipment access server is generally evenly distributed in the keep Alive Packet cycleIn T, i.e., preset duration is 1 second, then the quantity of access server per second is N/T platforms.
It should be noted that content and the said method such as information exchange, implementation procedure in book server between each moduleEmbodiment is based on same design, and particular content can be found in the narration in the inventive method embodiment, and here is omitted.
It should be noted that above-described embodiment can independent assortment as needed.The above is only the preferred of the present inventionEmbodiment, it is noted that for those skilled in the art, in the premise without departing from the principle of the inventionUnder, some improvements and modifications can also be made, these improvements and modifications also should be regarded as protection scope of the present invention.

Claims (10)

CN201611063095.7A2016-11-282016-11-28Connection establishing method and serverPendingCN106603633A (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201611063095.7ACN106603633A (en)2016-11-282016-11-28Connection establishing method and server

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201611063095.7ACN106603633A (en)2016-11-282016-11-28Connection establishing method and server

Publications (1)

Publication NumberPublication Date
CN106603633Atrue CN106603633A (en)2017-04-26

Family

ID=58595152

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201611063095.7APendingCN106603633A (en)2016-11-282016-11-28Connection establishing method and server

Country Status (1)

CountryLink
CN (1)CN106603633A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN111049779A (en)*2018-10-122020-04-21伊姆西Ip控股有限责任公司Information processing method, electronic device, and computer program product
US11182380B2 (en)2017-06-302021-11-23Nchain Licensing AgFlow control for probabilistic relay in a blockchain network

Citations (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN101052232A (en)*2007-05-182007-10-10清华大学Call admittance control method based on dynamic threshold in radio/mobile network
CN102347909A (en)*2011-11-222012-02-08迈普通信技术股份有限公司Method and device for sending massive protocol messages
CN104796998A (en)*2014-01-162015-07-22中国移动通信集团广东有限公司Internet-of-things equipment, Internet-of-things system, and method for improving the transmission stability of GPRS module

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN101052232A (en)*2007-05-182007-10-10清华大学Call admittance control method based on dynamic threshold in radio/mobile network
CN102347909A (en)*2011-11-222012-02-08迈普通信技术股份有限公司Method and device for sending massive protocol messages
CN104796998A (en)*2014-01-162015-07-22中国移动通信集团广东有限公司Internet-of-things equipment, Internet-of-things system, and method for improving the transmission stability of GPRS module

Cited By (8)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US11182380B2 (en)2017-06-302021-11-23Nchain Licensing AgFlow control for probabilistic relay in a blockchain network
US11341123B2 (en)2017-06-302022-05-24Nchain Licensing AgProbabilistic relay for efficient propagation in a blockchain network
US11609902B2 (en)2017-06-302023-03-21Nchain Licensing AgFlow control for probabilistic relay in a blockchain network
US11886426B2 (en)2017-06-302024-01-30Nchain Licensing AgProbabilistic relay for efficient propagation in a blockchain network
US12007984B2 (en)2017-06-302024-06-11Nchain Licensing AgFlow control for probabilistic relay in a blockchain network
US12265523B2 (en)2017-06-302025-04-01Nchain Licensing AgProbabilistic relay for efficient propagation in a blockchain network
CN111049779A (en)*2018-10-122020-04-21伊姆西Ip控股有限责任公司Information processing method, electronic device, and computer program product
CN111049779B (en)*2018-10-122022-04-26伊姆西Ip控股有限责任公司Information processing method, electronic device, and computer-readable medium

Similar Documents

PublicationPublication DateTitle
US10511970B2 (en)Internet access authentication method and client, and computer storage medium
CN109089298B (en)Bluetooth and wifi dual-protocol device network access method and device
EP3123762B1 (en)Wlan access point which approves internet access only if quality of the radio link is sufficiently good
EP2107762A3 (en)Session management system and method of controlling the same
CN103164244A (en)Firmware system remote updating method based on universal extensible firmware interface
CN106161385A (en)The long-range control method of a kind of equipment and device
CN106713454B (en)A kind of method for connecting network and device
EP4304229A3 (en)Method for updating authentication result and communication apparatus
CN110798453B (en) Data processing method and device for one-key login
WO2017166493A1 (en)Bandwidth estimation method and device
CN113259372A (en)Method for dynamic allocation channel to penetrate intranet to access local system
RU2017103781A (en) METHOD FOR CALCULATING BOARDS IN REAL TIME MODE, GATEWAY AND DEVICE FOR CALCULATING BOARDS IN REAL TIME MODE
CN108200218A (en)A kind of method, apparatus and electronic equipment for realizing load balancing
CN106603633A (en)Connection establishing method and server
CN103685398B (en)Communication connection method for building up and communication system
CN103535015A (en)Management method of public network address resource, terminal control protocol server and client
CN105471963A (en)Mobile device management method and system based on cloud platform
US8464331B2 (en)Data transmission management server and method
CN104333611A (en)Method and device for adjusting aging time
CN118784474A (en) Baud rate adjustment method, device, equipment and storage medium
CN105573776B (en)A kind of software installation method and server in station of server in station
CN103765819B (en) A data configuration method and network management server
CN106230877B (en)Remote management method, system and equipment of equipment
EP2739078A1 (en)Method, device, and system for establishing neighboring cell relationship
WO2017080499A1 (en)Management method and device for managing instruction transmission and automatic vnf scaling function

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
WD01Invention patent application deemed withdrawn after publication

Application publication date:20170426

WD01Invention patent application deemed withdrawn after publication

[8]ページ先頭

©2009-2025 Movatter.jp