CN104142868B - Establish the method and device of connection - Google Patents
Establish the method and device of connection Download PDFInfo
- Publication number
- CN104142868B CN104142868B CN201310172564.9A CN201310172564A CN104142868B CN 104142868 B CN104142868 B CN 104142868B CN 201310172564 A CN201310172564 A CN 201310172564A CN 104142868 B CN104142868 B CN 104142868B
- Authority
- CN
- China
- Prior art keywords
- connection
- identifier
- match
- pool
- user terminal
- 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.)
- Active
Links
Abstract
The invention discloses a kind of method and devices for establishing connection, belong to computer field.The described method includes: obtaining the corresponding connection request of service provided by application program;The connection identifier that the determining connection identifier carried with connection request matches in the connection pool constructed in advance;The corresponding connection of connection request is obtained at least one corresponding connection of the connection identifier to match, and the connection that will acquire is sent to user terminal, so that the application program of user terminal is according to the connection got connection corresponding with server foundation service.The connection identifier that the present invention is matched by the connection identifier carried with connection request determining in connection pool, and after obtaining the corresponding connection of connection request, the connection that will acquire is sent to application program, connection pool is allowed to provide connection for multiple application programs, avoid the waste of server connection resource, the utilization rate for improving connection pool reduces the cost of building connection pool.
Description
Technical field
The present invention relates to computer field, in particular to a kind of method and device for establishing connection.
Background technique
In computer field, the application program of user terminal can provide multiple services for user, provide each clothes
It, usually all can be to server read/write data when business.Before read/write data, application program needs a port with server
Establish connection.Therefore, each connection can be by the IP(Internet Protocol of server, Internet protocol) address and end
Mouth ID(Identifier, mark) it uniquely determines.It is longer that some are connected to the time required when establishing, for example, connecting establishing TCP
When connecing, application program and server will carry out " three-way handshake " (three-way handshake), i.e. application program and server
TCP connection could be established after confirm three times.Therefore, how connection is quickly established, is to improve application program and server
Between data signaling rate key.
The prior art when establishing connection, for each application program of user terminal, create in advance by the device for establishing connection
Multiple connections are built, construct the corresponding connection pool of each application program according to the corresponding multiple connections of each application program;Work as user
When the application program of terminal needs to establish connection with server, which obtains the connection request of application program,
And determine the corresponding connection pool of the application program;The corresponding company of connection request is obtained from the corresponding connection pool of the application program
It connects, and the connection that will acquire is sent to user terminal, so that the application program on the user terminal is according to the connection got
Connection is established with server.
In the implementation of the present invention, the inventor finds that the existing technology has at least the following problems:
The prior art is established in the mode of connection, needs that multiple connections are pre-created for each application program, to form
The corresponding connection pool of each application program, even if the connection request of different application corresponds to identical connection, it is still desirable to weight
Multiple execute is that different application constructs the process for being correspondingly connected with pond, and the connection for repeating creation leads to the wave of server connection resource
Take;And the corresponding connection pool of each application program is only that the application program provides connection, causes the utilization rate of connection pool not high, at
This is higher.
Summary of the invention
In order to solve problems in the prior art, the embodiment of the invention provides a kind of method and devices for establishing connection.Institute
It is as follows to state technical solution:
On the one hand, a kind of method for establishing connection is provided, which comprises
The corresponding connection request of service provided by application program is obtained, is carried and the service in the connection request
Corresponding connection identifier;
The connection identifier that the determining connection identifier carried with the connection request matches in the connection pool constructed in advance,
The connection identifier to match corresponds at least one connection;
The corresponding connection of the connection request is obtained from least one corresponding connection of the connection identifier to match,
And the connection that will acquire is sent to user terminal, so that the company that the application program on the user terminal is got according to
It connects and establishes the corresponding connection of the service with server.
On the other hand, a kind of device for establishing connection is provided, described device includes:
First obtains module, for obtaining the corresponding connection request of service, the connection request provided by application program
In carry connection identifier corresponding with the service;
Determining module, for determining that the connection got with the first acquisition module is asked in the connection pool constructed in advance
The connection identifier for asking the connection identifier of carrying to match, the connection identifier to match correspond at least one connection;
Second obtains module, at least one corresponding company of the connection identifier to match for determining from the determining module
Connect the corresponding connection of the middle acquisition connection request;
First sending module, the connection for getting the second acquisition module is sent to user terminal, so that institute
It states connection that the application program on user terminal is got according to and server and establishes the corresponding connection of the service.
Technical solution provided in an embodiment of the present invention has the benefit that
By determining what the connection identifier carried with the connection request got matched in the connection pool constructed in advance
Connection identifier, and will acquire after the corresponding connection of acquisition connection request in the corresponding connection of connection identifier to match
Connection is sent to user terminal, so that the application program of user terminal and server establish connection, when the connection of application program is asked
Ask corresponding connection when being pre-created in connection pool, without repeating creation connection, so that the connection pool constructed in advance can be with
Connection is provided for multiple application programs, avoids the waste of server connection resource, the utilization rate of connection pool is improved, reduces
Construct the cost of connection pool.
Detailed description of the invention
To describe the technical solutions in the embodiments of the present invention more clearly, make required in being described below to embodiment
Attached drawing is briefly described, it should be apparent that, drawings in the following description are only some embodiments of the invention, for
For those of ordinary skill in the art, without creative efforts, it can also be obtained according to these attached drawings other
Attached drawing.
Fig. 1 is a kind of schematic diagram of implementation environment for establishing connection provided in an embodiment of the present invention;
Fig. 2 is a kind of method flow diagram for establishing connection that the embodiment of the present invention one provides;
Fig. 3 is a kind of method flow diagram for establishing connection provided by Embodiment 2 of the present invention;
Fig. 4 be the embodiment of the present invention three provide the first establish the apparatus structure schematic diagram of connection;
Fig. 5 is the apparatus structure schematic diagram for establishing connection for second that the embodiment of the present invention three provides;
Fig. 6 be the embodiment of the present invention three provide the third establish the apparatus structure schematic diagram of connection;
Fig. 7 is the 4th kind of the offer of the embodiment of the present invention three and establishes the apparatus structure schematic diagram of connection;
Fig. 8 is the 5th kind of the offer of the embodiment of the present invention three and establishes the apparatus structure schematic diagram of connection;
Fig. 9 is the 6th kind of the offer of the embodiment of the present invention three and establishes the apparatus structure schematic diagram of connection;
Figure 10 is the 7th kind of the offer of the embodiment of the present invention three and establishes the apparatus structure schematic diagram of connection;
Figure 11 is a kind of structural schematic diagram for terminal that the embodiment of the present invention four provides.
Specific embodiment
To make the object, technical solutions and advantages of the present invention clearer, below in conjunction with attached drawing to embodiment party of the present invention
Formula is described in further detail.
The embodiment of the invention provides a kind of methods for establishing connection, referring to FIG. 1, it illustrates the embodiment of the present invention to mention
The structural schematic diagram for establishing implementation environment involved in the method for connection supplied.The implementation environment includes the device for establishing connection
101, user terminal 102 and server 103.
Wherein, the device of establishing connection of the device 101 of connection as described in following example three is established.In addition, the company of foundation
The device 101 connect can be only fitted in user terminal 102, also can be only fitted in server 103, can also will establish connection
Device 101 is configured to the other equipment etc. other than user terminal 101 and server 103.When the device 101 for establishing connection is matched
When the other equipment being set to other than user terminal 101 and server 103, the device 101 and user terminal of connection are established
102, user terminal 102 and server 103 carry out data communication by network.The device 101 for establishing connection is used for from preparatory
After getting connection in the connection pool of building, it is sent to user terminal 102;The application program of user terminal 102 is according to the company of foundation
Connection is established in the connection and server 103 that the device 101 connect is got.
Embodiment one
In conjunction with above-mentioned implementation environment, the embodiment of the invention provides a kind of methods for establishing connection, referring to fig. 2, method stream
Journey includes:
201: obtaining the corresponding connection request of service provided by application program, carried in connection request opposite with service
The connection identifier answered.
Preferably, the connection that will acquire is sent to after user terminal, further includes:
If the application program of user terminal establishes the corresponding connection failure of service according to the connection got and server,
The connection got is then deleted from connection pool.
202: the connection identifier that the determining connection identifier carried with connection request matches in the connection pool constructed in advance,
The connection identifier to match corresponds at least one connection.
Wherein, the connection identifier that each connection request carries is used for each service of identification application.
Preferably, the connection mark that the determining connection identifier carried with connection request matches from the connection pool constructed in advance
After knowledge, further includes:
If connection corresponding to connection request has not been obtained from least one corresponding connection of the connection identifier to match,
The corresponding connection of connection request is then created, and the connection of creation is sent to user terminal, so that the application program of user terminal
The corresponding connection of the service is established according to the connection of creation and server.
Preferably, after the corresponding connection of creation connection request, further includes:
By the corresponding connection of the connection identifier for being connected to matching of creation, and it is added to the connection pool constructed in advance
In.
Preferably, by the corresponding connection of the connection identifier for being connected to matching of creation, and it is added to preparatory building
Connection pool in front of, further includes:
Judge whether the quantity of the corresponding connection of connection identifier to match reaches preset threshold;
If the quantity of the corresponding connection of the connection identifier to match is not up to preset threshold, execute the connection of creation
As connection corresponding with the connection identifier to match, and it is added to the step in the connection pool constructed in advance.
Preferably, after judging whether the quantity of connection corresponding to the connection identifier to match reaches preset threshold, also
Include:
If the quantity of the corresponding connection of the connection identifier to match reaches preset threshold, phase is deleted from connection pool
At least one corresponding connection of the connection identifier matched, and execute the connection identifier for being connected to matching of creation is corresponding
Connection, and it is added to the step in the connection pool constructed in advance.
Preferably, the connection mark that the determining connection identifier carried with connection request matches in the connection pool constructed in advance
Before knowledge, further includes:
Corresponding connection identifier is distributed for each service of application program, and is pre-created for each connection identifier corresponding
At least one connection;
According to each connection identifier and its at least one corresponding connection building connection pool.
203: obtaining the corresponding connection of connection request from least one corresponding connection of the connection identifier to match, and will
The connection got is sent to user terminal, so that the application program on user terminal is built according to the connection got with server
It is vertical to service corresponding connection.
In conclusion method provided in an embodiment of the present invention, by determining and getting in the connection pool constructed in advance
The connection identifier that matches of connection identifier that carries of connection request, and obtained in the corresponding connection of connection identifier to match
After the corresponding connection of connection request, the connection that will acquire is sent to user terminal, so that the application program and clothes of user terminal
Business device establishes connection, when the corresponding connection of the connection request of application program has been pre-created in connection pool, creates without repeating
Connection is built, the connection pool constructed in advance is allowed to provide connection for multiple application programs, avoids server connection resource
Waste, improves the utilization rate of connection pool, reduces the cost of building connection pool.
Embodiment two
In order to improve the utilization rate of connection pool, cost is reduced, the embodiment of the invention provides a kind of method for establishing connection,
The main body for executing the method for the embodiment of the present invention is to establish the device of connection, which can be terminal, service
Device or other equipment etc..In conjunction with the content of above-described embodiment one, referring to Fig. 3, method flow provided in this embodiment includes:
301: obtaining the corresponding connection request of service provided by application program, carried and the service phase in connection request
Corresponding connection identifier.
For the step, a usual application program is capable of providing multiple services, when providing each service, require to
Corresponding server read/write data.In order to corresponding server read/write data, it is necessary first to establish connection with server.By
It is normally operated on user terminal in application program, it can be corresponding by service provided by user terminal sending application program
Connection request gives the device for establishing connection, and the device for establishing connection is asked in the connection for the application program for receiving user terminal transmission
After asking, the corresponding connection request of service provided by application program is obtained.It can be with other than connection identifier, in connection request
Carry the information such as the User ID of application program, for the information carried in connection request, the embodiment of the present invention herein without
It is specific to limit.
302: the connection identifier that the determining connection identifier carried with connection request matches in the connection pool constructed in advance.
In order to establish connection more quickly, needs to construct connection pool in advance, specifically include: for each of application program
Service distributes corresponding connection identifier, and at least one corresponding connection is pre-created for each connection identifier;According to each company
Connect mark and its at least one corresponding connection building connection pool.
Wherein, since application program can provide multiple services, each service for application program is needed to distribute corresponding
Connection identifier, for identifying the service.Divide in addition in advance to send the service of the application program of connection request in above-mentioned steps 301
Except mark, corresponding mark can also be distributed for the service of other applications in advance according to the needs of practical application, this
Inventive embodiments are to this without specifically limiting.Since the service that multiple application programs can be provided can be identical, for application
When each service of program distributes corresponding connection identifier, the same connection identifier can be distributed for identical service.Certainly,
More than two connection identifier can be distributed for identical service, the embodiment of the present invention is not herein to the company for each service distribution
The quantity for connecing mark is specifically limited, and guarantees that each connection identifier can be identified for that a service.
After distributing corresponding connection identifier for each service, corresponding at least one is pre-created for each connection identifier
A connection.The mode that connection is pre-created is same as the prior art, and details are not described herein.The type for the connection being pre-created can be with
It selectes according to the actual situation, for example, can be TCP connection etc..Since each connection identifier corresponds to each clothes of application terminal
Business, thus when at least one corresponding connection is pre-created for each connection identifier, it can be according to each clothes of application terminal
Business creates at least one the corresponding connection of each connection identifier.
In a particular application, when the application program of user terminal and server establish connection, be all by with server
A port establishes connection, thus to server read/write data.Since the quantity of server can be to be multiple, and each service
The port of device may be it is multiple, can with (IP, Port) binary group identify one connection, wherein IP expression server IP
Address, the port Port() indicate server port id.In general, a service of application program can be at least the two of server
Either port read/write data in a port, or can be to answer therefore to the identical port read/write data of multiple servers
With the corresponding multiple connections (IP, Port) of each service-creation of terminal, also as each connection identifier creation is corresponding multiple
It connects (IP, Port).
After distribution obtains connection identifier and establishes corresponding connection, according to each connection identifier and its it is corresponding at least
One connection constructs connection pool.Wherein, the connection pool of building can store in the device for establishing connection, can also be stored in it
In his database, the embodiment of the present invention does not limit the storage location of the connection pool of building specifically herein.It is building every time
When vertical connection, the operation of building connection pool in advance is not needed to be carried out every time.After connection pool constructs, subsequent each foundation
When connection, the connection pool can be used.
After constructing connection pool through the above way, due in the connection pool that preferentially constructs to each service of application program point
At least one connection is created with corresponding connection identifier, and for each connection identifier, when the clothes that other applications can be provided
Be engaged in it is corresponding be connected to when having been created in the connection pool constructed in advance, can according to connection identifier corresponding with the service from
The corresponding connection of the service is got in the connection pool constructed in advance, and the connection of the service is created without repetition, avoids clothes
The waste of business device connection resource, and the connection pool constructed in advance can provide service for multiple application programs, utilization rate is also big
It improves greatly.
For example, 3 services are capable of providing with application program 1, respectively service 1, service 2 and service 3, application program
2 are capable of providing 2 services, respectively service 1 and are illustrated for servicing 4, are the service 1 of application program 1 and application program 2
Corresponding connection identifier NetID1 to NetID4 is distributed to service 4;And respectively NetID1 to NetID4 creation is corresponding at least
One connection, and connection pool is constructed according to each connection identifier and its corresponding connection, as shown in table 1 below.
Table 1
After the completion of connection pool constructs in advance, based on the connection pool constructed in advance, it can therefrom determine and be taken with connection request
The connection identifier that the connection identifier of band matches.
For example, for carrying connection identifier NetID1 in the connection request got in step 301, Cong Rubiao
The determining connection identifier to match with connection identifier that is being carried in connection request in the connection pool constructed in advance shown in 1
NetID1。
It should be noted that the connection identifier that determining and connection request carries in the connection pool constructed in advance matched
After connection identifier, if there is company corresponding with connection request at least one corresponding connection of the connection identifier to match
It connects, referring specifically to following steps 303 to step 304.If do not deposited at least one corresponding connection of the connection identifier to match
In connection corresponding with connection request, then it can choose and execute following steps 305.
303: obtaining the corresponding connection of connection request from least one corresponding connection of the connection identifier to match.
For the step, since the connection identifier to match corresponds at least one connection, from the connection identifier pair to match
When obtaining the corresponding connection of connection request at least one connection answered, it can select according to the actual situation in following two mode
Either formula:
(1) one is arbitrarily obtained from least one corresponding connection of the connection identifier to match be connected to connection request
Corresponding connection.
Each connection as corresponding to the connection identifier to match is the corresponding application of connection identifier according to matching
The service-creation of program, therefore, it is corresponding that any connection corresponding to the connection identifier to match all can serve as connection request
Connection, arbitrarily obtain one connection.
(2) if also carrying User ID in connection request, according to the User ID that is carried in connection request from matching
The corresponding connection of connection request is obtained at least one corresponding connection of connection identifier.
In building connection pool in advance, the numerical value of corresponding User ID can be distributed for the corresponding each connection of connection identifier
The numberical range of range, a User ID can correspond to multiple connections.Therefore, exist according to the User ID carried in connection request
When obtaining corresponding connection at least one corresponding connection of the connection identifier to match, it can first determine what connection request carried
The numberical range of User ID locating for User ID, then determining User ID is obtained from the corresponding connection of connection identifier to match
The corresponding connection of numberical range, what be will acquire is connected to the corresponding connection of connection request.Certainly, if it is determined that user
The numberical range of ID is corresponding to be connected with multiple, can arbitrarily be obtained one and is connected to the corresponding connection of connection request.
Wherein, the numberical range of User ID can be the numberical range of the complete number of User ID, be also possible to User ID
Wherein several bit digitals locating for numberical range, for example, it may be numberical range locating for the rear two digits of User ID, for
The numberical range of pre-assigned User ID, the embodiment of the present invention is herein without specifically limiting.
For example, also to carry User ID in the connection request that gets in step 301 for 186435, in preparatory structure
The numberical range of corresponding User ID and the numerical value of User ID are distributed in the connection pool built for the corresponding each connection of connection identifier
Range is numberical range locating for the rear two digits of User ID, for obtaining connection pool as shown in table 2 below, determines that connection is asked
The numberical range for seeking User ID locating for the rear two digits 35 of the User ID of carrying is [00-50], from the connection to match
Identify NetID1 it is corresponding 2 connection in obtain User ID numberical range be [00-50] it is corresponding connection (202.198.0.0,
100) connection (202.198.0.0,100), is determined as the corresponding connection of connection request.
Table 2
304: the connection that will acquire is sent to user terminal, so that the application program of user terminal is according to the company got
It connects and establishes the corresponding connection of the service with server, the process for establishing connection terminates.
After getting the corresponding connection of connection request in step 303, the connection hair that the device of connection will acquire is established
Give user terminal.Since the connection got is the connection being pre-created, the application program of user terminal is not necessarily to and clothes
Business device resettles connection after carrying out " three-way handshake ", but it is corresponding that the service is directly established with server according to the connection got
Connection.Since the connection got can be identified for that the port of server, the application program of user terminal can be according to obtaining
The connection got directly establishes the corresponding connection of the service with the port for the server that the connection is identified.
For example, it for get connection (202.198.0.0,100) in step 303, will connect
(202.198.0.0,100) is sent to user terminal so that the application program of user terminal according to connection (202.198.0.0,
100) the corresponding connection of the service is established with the port 100 for the server that IP address is 202.198.0.0.
It should be noted that the application program of user terminal and server establish the corresponding connection of the service, namely with obtain
After the corresponding connection of the service is established in the port for the server that the connection got is identified, the application program of user terminal can lead to
The port of the server is crossed to server read/write data.The service pair is established for the application program and server of user terminal
Concrete operations after the connection answered, the embodiment of the present invention is herein without specifically limiting.
Preferably, after the connection that will acquire is sent to user terminal, if the application program of user terminal according to
The connection got and server establish the corresponding connection failure of the service, then the connection got is deleted from connection pool.Its
In, the reason of establishing connection failure, can be since the port of the corresponding server of connection got is damaged, Huo Zheyou
It changes in the configuration of server, which is no longer used to carry out the operation of read/write data with the application program of user terminal.
The reason of corresponding connection failure of the service is established according to the connection got and server for the application program of user terminal,
The embodiment of the present invention is herein without specifically limiting.Since the application program of user terminal is according to the connection and server got
After establishing the corresponding connection failure of the service, it can determine that the connection got is also not used to as other applications and clothes
Business device establishes the corresponding connection of the service, in order to guarantee the availability of the connection in connection pool, can delete and obtain from connection pool
The connection got.
After the application program of user terminal establishes according to the connection got and server the corresponding connection failure of service,
Step 301-304 or step 301-302 and step 305 can be continued to execute, so that the application program of user terminal can be with
Server, which is established, services corresponding connection, " holds three times alternatively, the application program of user terminal also can choose with server progress
The mode of hand " establishes connection, corresponding with server foundation service according to the connection got for the application program of user terminal
Connection failure after operation, the embodiment of the present invention is herein without specifically limiting.
305: the corresponding connection of creation connection request, and the connection of creation is sent to user terminal, so that user terminal
Application program the corresponding connection of the service is established according to the connection of creation and server, the process for establishing connection terminates.
When the corresponding connection of connection request has not been obtained at least one corresponding connection of the connection identifier to match,
The device for establishing connection can create corresponding connection for the connection request, and the connection of creation is sent to user terminal.By
It has been created via the device for establishing connection in connection, the application program of user terminal can also be with clothes according to the connection of creation
The corresponding connection of the service is established between business device.
Wherein, the corresponding connection of connection request has not been obtained at least one corresponding connection of the connection identifier to match
The reason of, it can be due to not creating corresponding connection or connection request carrying in advance for the connection identifier to match
User ID locating for numberical range User ID corresponding with connection each in the connection identifier to match numberical range not
It is identical, it is, of course, also possible to be to cause not obtain at least one corresponding connection of the connection identifier to match due to other reasons
The corresponding connection of connection request is got, the embodiment of the present invention is not herein at least one corresponding company of the connection identifier to match
The reason of corresponding connection of connection request has not been obtained in connecing specifically is limited.
Further, in order to save it is subsequent establish connection the time it takes, creating corresponding connection for connection request
It later, can also include: that the corresponding connection of the connection identifier for being connected to matching of creation and is added to preparatory building
Connection pool in.It is added in the connection pool constructed in advance by the connection that will be created, when the device that next time establishes connection obtains
When to identical connection request, connection corresponding with the connection request can be got from connection pool.
It should be noted that the port number due to server is limited, i.e. the connection resource of server is limited,
In order to guarantee the normal operation of server, connection cannot be unlimitedly created.It therefore, can be the corresponding company of each connection identifier
The quantity connect sets a threshold value, to guarantee that the quantity of the corresponding connection of each connection identifier will not unlimitedly increase.?
By the corresponding connection of the connection identifier for being connected to matching of creation, and before being added in the connection pool constructed in advance,
It is further comprising the steps of:
Judge whether the quantity of the corresponding connection of connection identifier to match reaches preset threshold;If the connection to match
The quantity for identifying corresponding connection is not up to preset threshold, then executes the connection identifier pair for being connected to and matching of creation
The connection answered, and it is added to the step in the connection pool constructed in advance.Wherein, the size of preset threshold can be according to the actual situation
Specific setting, for example, can be set to 20,25 or 30 etc., the embodiment of the present invention does not have the size of preset threshold herein
Body limits.
In addition, if the quantity of the corresponding connection of the connection identifier to match reaches preset threshold, it can choose and not execute
By the corresponding connection of the connection identifier for being connected to matching of creation, and it is added to the step in the connection pool constructed in advance
Suddenly.Preferably, at least one corresponding connection of the connection identifier to match can also be deleted from connection pool, and is executed and will be created
The corresponding connection of the connection identifier for being connected to matching, and be added to the step in the connection pool constructed in advance.Pass through
At least one corresponding connection of the connection identifier to match is first deleted, then executes and the connection of creation is added to the company constructed in advance
It connects in pond, ensure that the quantity of the corresponding connection of the connection identifier to match is no more than preset threshold.
In order to reduce delete at least one the corresponding connection of the connection identifier that matches after established to according to the connection pool
The influence of the process of connection, at least one corresponding connection of the connection identifier that deletion matches, it may be considered that following strategy:
It is corresponding when obtaining connection request from the corresponding connection of connection identifier to match using mode one in step 303
When connection, since the corresponding each connection of the connection identifier to match is for according to the corresponding application program of connection identifier of matching
Service-creation, therefore the connection identifier to match can be deleted from connection pool as the corresponding connection of connection request
At least one corresponding connection, the influence for the process for establishing connection according to the connection pool of the building to next time are smaller.Work as use
When mode two obtains the corresponding connection of connection request from the corresponding connection of connection identifier to match in step 303, due to phase
In the corresponding connection of matched connection identifier, the numberical range of a User ID can correspond to multiple connections, in order to reduce next time
The influence that the process of connection is established according to the connection pool of the building, the numberical range for needing to delete User ID from connection pool are corresponding
At least one of multiple connections connection.
In specific delete, at least one corresponding connection of the connection identifier to match can be arbitrarily deleted from connection pool
Or at least one of corresponding multiple connections of numberical range that User ID is arbitrarily deleted from connection pool connection.Further, since
Creation time connects often earlier in connection pool has that bigger probability is not used to application program and server establishes the clothes
Being engaged in corresponding connection can be with pre-recorded each connection identifier pair in order to guarantee the availability of the connection created in connection pool
The creation time for the connection answered, deleted from connection pool the connection identifier to match it is corresponding at least one connection when, delete
Creation time at least one connection earlier in the corresponding connection of the connection identifier to match;Alternatively, being deleted from connection pool
When at least one of the corresponding multiple connections of the numberical range of User ID connection, the numberical range for deleting User ID is corresponding more
Creation time at least one connection earlier in a connection.
Other than above-mentioned deletion strategy, when deleting, which kind of mode also may not need consideration in step 303 is using
The corresponding connection of connection request is obtained from the corresponding connection of connection identifier to match, but directly from the connection mark to match
Know and arbitrarily delete at least one connection in corresponding connection, or when according to the creation of the corresponding connection of the connection identifier to match
Between, it is removed from it creation time at least one connection earlier.At this point, if the corresponding connection of the numberical range of User ID and
The connection is deleted, and in the connection request that next time carries User ID, User ID is in the numberical range of the User ID, then
One connection can be created using the method for step 205 again, and set the connection created again to the number with the User ID
It is corresponding to be worth range.For in the specific strategy for deleting at least one the corresponding connection of connection identifier to match, the present invention is implemented
Example is herein without specifically limiting.
It should be noted that being asked if connection has not been obtained at least one corresponding connection of the connection identifier to match
Corresponding connection is asked, other than selection executes above-mentioned steps 305, it is also an option that by the application program and service of user terminal
Device establishes connection by way of " three-way handshake ", for not obtaining at least one corresponding connection of the connection identifier to match
After getting the corresponding connection of connection request, how the application program and server of user terminal establish connection, and the present invention is implemented
Example is herein without specifically limiting.
In conclusion method provided in an embodiment of the present invention, by determining and getting in the connection pool constructed in advance
The connection identifier that matches of connection identifier that carries of connection request, and obtained in the corresponding connection of connection identifier to match
After the corresponding connection of connection request, the connection that will acquire is sent to user terminal, so that the application program and clothes of user terminal
Business device establishes connection, when the corresponding connection of the connection request of application program has been pre-created in connection pool, creates without repeating
Connection is built, the connection pool constructed in advance is allowed to provide connection for multiple application programs, avoids server connection resource
Waste, improves the utilization rate of connection pool, reduces the cost of building connection pool.
Embodiment three
The embodiment of the invention provides a kind of device for establishing connection, the device is for executing above-described embodiment one or implementing
The method for establishing connection that example two provides.Referring to fig. 4, which includes:
First obtains module 401, corresponding connection request is serviced provided by application program for obtaining, in connection request
Carry connection identifier corresponding with service;
Determining module 402, for determining the connection got with the first acquisition module 401 in the connection pool constructed in advance
The connection identifier that the connection identifier that request carries matches, the connection identifier to match correspond at least one connection;
Second obtain module 403, for from determining module 402 determine the connection identifier to match it is corresponding at least one
The corresponding connection of connection request is obtained in connection;
First sending module 404, the connection for getting the second acquisition module 403 are sent to user terminal, so that
Application program on user terminal is according to the connection got connection corresponding with server foundation service.
Preferably, referring to Fig. 5, the device further include:
First removing module 405 is established for the application program in user terminal according to the connection and server that get
When the corresponding connection failure of the service, the connection got is deleted from connection pool.
Preferably, referring to Fig. 6, the device further include:
First creation module 406, for from the connection identifier to match it is corresponding at least one connection in have not been obtained to
When the corresponding connection of connection request, the corresponding connection of creation connection request;
Second sending module 407, the connection for creating the first creation module 406 are sent to user terminal, so that with
The application program of family terminal establishes the corresponding connection of service according to the connection of creation and server.
Preferably, referring to Fig. 7, the device further include:
Adding module 408, the connection identifier for being connected to matching for creating the first creation module 406 are corresponding
Connection, and be added in the connection pool constructed in advance.
Preferably, referring to Fig. 8, the device further include:
Judgment module 409, for judging whether the quantity of the corresponding connection of the connection identifier to match reaches preset threshold,
And when the quantity of the corresponding connection of connection identifier to match is not up to preset threshold, then adding module 408.
Preferably, referring to Fig. 9, the device further include:
Second removing module 410 judges that the quantity of the corresponding connection of connection identifier to match reaches for judgment module 409
When to preset threshold, at least one corresponding connection of the connection identifier to match is deleted from connection pool, and execute adding module
408。
Preferably, referring to Figure 10, the device further include:
Distribution module 411, for distributing corresponding connection identifier for each service of application program;
Second creation module 412, each connection identifier for being distributed for distribution module 411 be pre-created it is corresponding at least
One connection;
Module 413 is constructed, each connection identifier and the second creation module 412 wound for distributing according to distribution module 411
At least one corresponding connection building connection pool of each connection identifier built.
In conclusion device provided in an embodiment of the present invention, by determining and getting in the connection pool constructed in advance
The connection identifier that matches of connection identifier that carries of connection request, and obtained in the corresponding connection of connection identifier to match
After the corresponding connection of connection request, the connection that will acquire is sent to user terminal, so that the application program and clothes of user terminal
Business device establishes connection, when the corresponding connection of the connection request of application program has been pre-created in connection pool, creates without repeating
Connection is built, the connection pool constructed in advance is allowed to provide connection for multiple application programs, avoids server connection resource
Waste, improves the utilization rate of connection pool, reduces the cost of building connection pool.
Example IV
Referring to Figure 11, the embodiment of the invention provides a kind of terminal, which can be used for implementing mentioning in above-described embodiment
The method for establishing connection supplied.Specifically:
Terminal 1100 may include RF(Radio Frequency, radio frequency) it circuit 110, includes one or more
The memory 120 of computer readable storage medium, input unit 130, display unit 140, sensor 150, voicefrequency circuit 160,
WiFi (wireless fidelity, Wireless Fidelity) module 170, the processing for including one or more than one processing core
The components such as device 180 and power supply 190.It will be understood by those skilled in the art that terminal structure shown in Figure 11 is not constituted pair
The restriction of terminal may include perhaps combining certain components or different component cloth than illustrating more or fewer components
It sets.Wherein:
RF circuit 110 can be used for receiving and sending messages or communication process in, signal sends and receivees, particularly, by base station
After downlink information receives, one or the processing of more than one processor 180 are transferred to;In addition, the data for being related to uplink are sent to
Base station.In general, RF circuit 110 includes but is not limited to antenna, at least one amplifier, tuner, one or more oscillators, uses
Family identity module (SIM) card, transceiver, coupler, LNA(Low Noise Amplifier, low-noise amplifier), duplex
Device etc..In addition, RF circuit 110 can also be communicated with network and other equipment by wireless communication.The wireless communication can make
With any communication standard or agreement, and including but not limited to GSM (Global System of Mobile communication, entirely
Ball mobile communcations system), GPRS (General Packet Radio Service, general packet radio service), CDMA (Code
Division Multiple Access, CDMA), WCDMA (Wideband Code Division Multiple
Access, wideband code division multiple access), LTE (Long Term Evolution, long term evolution), Email, SMS (Short
Messaging Service, short message service) etc..
Memory 120 can be used for storing software program and module, and processor 180 is stored in memory 120 by operation
Software program and module, thereby executing various function application and data processing.Memory 120 can mainly include storage journey
Sequence area and storage data area, wherein storing program area can application program needed for storage program area, function (for example sound is broadcast
Playing function, image player function etc.) etc.;Storage data area can store according to terminal 1100 use created data (such as
Audio data, phone directory etc.) etc..In addition, memory 120 may include high-speed random access memory, it can also include non-easy
The property lost memory, a for example, at least disk memory, flush memory device or other volatile solid-state parts.Correspondingly,
Memory 120 can also include Memory Controller, to provide the visit of processor 180 and input unit 130 to memory 120
It asks.
Input unit 130 can be used for receiving the number or character information of input, and generate and user setting and function
Control related keyboard, mouse, operating stick, optics or trackball signal input.Specifically, input unit 130 may include touching
Sensitive surfaces 131 and other input equipments 132.Touch sensitive surface 131, also referred to as touch display screen or Trackpad are collected and are used
Family on it or nearby touch operation (such as user using any suitable object or attachment such as finger, stylus in touch-sensitive table
Operation on face 131 or near touch sensitive surface 131), and corresponding attachment device is driven according to preset formula.It is optional
, touch sensitive surface 131 may include both touch detecting apparatus and touch controller.Wherein, touch detecting apparatus detection is used
The touch orientation at family, and touch operation bring signal is detected, transmit a signal to touch controller;Touch controller is from touch
Touch information is received in detection device, and is converted into contact coordinate, then gives processor 180, and can receive processor 180
The order sent simultaneously is executed.Furthermore, it is possible to using multiple types such as resistance-type, condenser type, infrared ray and surface acoustic waves
Realize touch sensitive surface 131.In addition to touch sensitive surface 131, input unit 130 can also include other input equipments 132.Specifically,
Other input equipments 132 can include but is not limited to physical keyboard, function key (such as volume control button, switch key etc.),
One of trace ball, mouse, operating stick etc. are a variety of.
Display unit 140 can be used for showing information input by user or the information and terminal 1100 that are supplied to user
Various graphical user interface, these graphical user interface can be made of figure, text, icon, video and any combination thereof.
Display unit 140 may include display panel 141, optionally, can use LCD (Liquid Crystal Display, liquid crystal
Show device), the forms such as OLED (Organic Light-Emitting Diode, Organic Light Emitting Diode) configure display panel
141.Further, touch sensitive surface 131 can cover display panel 141, when touch sensitive surface 131 detects touching on it or nearby
After touching operation, processor 180 is sent to determine the type of touch event, is followed by subsequent processing device 180 according to the type of touch event
Corresponding visual output is provided on display panel 141.Although touch sensitive surface 131 and display panel 141 are conducts in Figure 11
Two independent components realize input and input function, but in some embodiments it is possible to by touch sensitive surface 131 and display
Panel 141 is integrated and realizes and outputs and inputs function.
Terminal 1100 may also include at least one sensor 150, such as optical sensor, motion sensor and other sensings
Device.Specifically, optical sensor may include ambient light sensor and proximity sensor, wherein ambient light sensor can be according to environment
The light and shade of light adjusts the brightness of display panel 141, and proximity sensor can close display when terminal 1100 is moved in one's ear
Panel 141 and/or backlight.As a kind of motion sensor, gravity accelerometer can detect in all directions (generally
Three axis) acceleration size, can detect that size and the direction of gravity when static, can be used to identify mobile phone posture application (ratio
Such as horizontal/vertical screen switching, dependent game, magnetometer pose calibrating), Vibration identification correlation function (such as pedometer, tap);Extremely
In other sensors such as gyroscope, barometer, hygrometer, thermometer, the infrared sensors that terminal 1100 can also configure, herein
It repeats no more.
Voicefrequency circuit 160, loudspeaker 161, microphone 162 can provide the audio interface between user and terminal 1100.Sound
Electric signal after the audio data received conversion can be transferred to loudspeaker 161, be converted to by loudspeaker 161 by frequency circuit 160
Voice signal output;On the other hand, the voice signal of collection is converted to electric signal by microphone 162, is received by voicefrequency circuit 160
After be converted to audio data, then by after the processing of audio data output processor 180, be sent to through RF circuit 110 such as another
Terminal, or audio data is exported to memory 120 to be further processed.Voicefrequency circuit 160 is also possible that earplug is inserted
Hole, to provide the communication of peripheral hardware earphone Yu terminal 1100.
WiFi belongs to short range wireless transmission technology, and terminal 1100 can help user to receive and dispatch electricity by WiFi module 170
Sub- mail, browsing webpage and access streaming video etc., it provides wireless broadband internet access for user.Although Figure 11 shows
Go out WiFi module 170, but it is understood that, and it is not belonging to must be configured into for terminal 1100, it completely can be according to need
It to omit within the scope of not changing the essence of the invention.
Processor 180 is the control centre of terminal 1100, utilizes each portion of various interfaces and connection whole mobile phone
Point, by running or execute the software program and/or module that are stored in memory 120, and calls and be stored in memory 120
Interior data execute the various functions and processing data of terminal 1100, to carry out integral monitoring to mobile phone.Optionally, it handles
Device 180 may include one or more processing cores;Preferably, processor 180 can integrate application processor and modulation /demodulation processing
Device, wherein the main processing operation system of application processor, user interface and application program etc., modem processor is mainly located
Reason wireless communication.It is understood that above-mentioned modem processor can not also be integrated into processor 180.
Terminal 1100 further includes the power supply 190(such as battery powered to all parts), it is preferred that power supply can pass through electricity
Management system and processor 180 are logically contiguous, to realize management charging, electric discharge and power consumption by power-supply management system
The functions such as management.Power supply 190 can also include one or more direct current or AC power source, recharging system, power supply event
Hinder the random components such as detection circuit, power adapter or inverter, power supply status indicator.
Although being not shown, terminal 1100 can also include camera, bluetooth module etc., and details are not described herein.Specifically at this
In embodiment, the display unit of terminal is touch-screen display, terminal further include have memory and one or more than one
Program, one of them perhaps more than one program be stored in memory and be configured to by one or more than one
Reason device execution states one or more than one program includes the instruction for performing the following operation:
The corresponding connection request of service provided by application program is obtained, is carried in connection request corresponding with service
Connection identifier;
The connection identifier that the determining connection identifier carried with connection request matches in the connection pool constructed in advance, phase
The connection identifier matched corresponds at least one connection;
The corresponding connection of connection request is obtained from least one corresponding connection of the connection identifier to match, and will acquire
To connection be sent to user terminal taken so that the application program on user terminal is established according to the connection that gets and server
It is engaged in corresponding connection.
Assuming that above-mentioned is the first possible embodiment, then provided based on the first possible embodiment
Second of possible embodiment in, in the memory of terminal, also include instructions for performing the following operations:
If the application program of user terminal establishes the corresponding connection failure of service according to the connection got and server,
The connection got is then deleted from connection pool.
In the third the possible embodiment provided based on the first possible embodiment, terminal is deposited
Also include instructions for performing the following operations in reservoir:
If connection corresponding to connection request has not been obtained from least one corresponding connection of the connection identifier to match,
The corresponding connection of connection request is then created, and the connection of creation is sent to user terminal, so that the application program of user terminal
According to the connection of creation connection corresponding with server foundation service.
In the 4th kind of possible embodiment provided based on the third possible embodiment, terminal is deposited
Also include instructions for performing the following operations in reservoir:
By the corresponding connection of the connection identifier for being connected to matching of creation, and it is added to the connection pool constructed in advance
In.
In the 5th kind of possible embodiment provided based on the 4th kind of possible embodiment, terminal is deposited
Also include instructions for performing the following operations in reservoir:
Judge whether the quantity of the corresponding connection of connection identifier to match reaches preset threshold;
If the quantity of the corresponding connection of the connection identifier to match is not up to preset threshold, execute the connection of creation
As connection corresponding with the connection identifier to match, and it is added to the step in the connection pool constructed in advance.
In the 6th kind of possible embodiment provided based on the 5th kind of possible embodiment, terminal is deposited
Also include instructions for performing the following operations in reservoir:
If the quantity of the corresponding connection of the connection identifier to match reaches preset threshold, phase is deleted from connection pool
At least one corresponding connection of the connection identifier matched, and execute the connection identifier for being connected to matching of creation is corresponding
Connection, and it is added to the step in the connection pool constructed in advance.
In the 7th kind of possible embodiment provided based on the first possible embodiment, terminal is deposited
Also include instructions for performing the following operations in reservoir:
Corresponding connection identifier is distributed for each service of application program, and is pre-created for each connection identifier corresponding
At least one connection;
According to each connection identifier and its at least one corresponding connection building connection pool.
In conclusion terminal provided in an embodiment of the present invention, by determining and getting in the connection pool constructed in advance
The connection identifier that matches of connection identifier that carries of connection request, and obtained in the corresponding connection of connection identifier to match
After the corresponding connection of connection request, the connection that will acquire is sent to user terminal, so that the application program and clothes of user terminal
Business device establishes connection, when the corresponding connection of the connection request of application program has been pre-created in connection pool, creates without repeating
Connection is built, the connection pool constructed in advance is allowed to provide connection for multiple application programs, avoids server connection resource
Waste, improves the utilization rate of connection pool, reduces the cost of building connection pool.
Implement five
The embodiment of the invention provides a kind of computer readable storage medium, which be can be
State computer readable storage medium included in the memory in embodiment;It is also possible to individualism, without supplying terminal
In computer readable storage medium.The computer-readable recording medium storage has one or more than one program, described
One or more than one program are used to execute the method for establishing connection by one or more than one processor, described
Method includes:
The corresponding connection request of service provided by application program is obtained, is carried in connection request corresponding with service
Connection identifier;
The connection identifier that the determining connection identifier carried with connection request matches in the connection pool constructed in advance, phase
The connection identifier matched corresponds at least one connection;
The corresponding connection of connection request is obtained from least one corresponding connection of the connection identifier to match, and will acquire
To connection be sent to user terminal taken so that the application program on user terminal is established according to the connection that gets and server
It is engaged in corresponding connection.
Assuming that above-mentioned is the first possible embodiment, then provided based on the first possible embodiment
Second of possible embodiment in, the connection that will acquire is sent to after user terminal, further includes:
If the application program of user terminal establishes the corresponding connection failure of service according to the connection got and server,
The connection got is then deleted from connection pool.
In the third the possible embodiment provided based on the first possible embodiment, from preparatory structure
After the connection identifier that the determining connection identifier carried with connection request matches in the connection pool built, further includes:
If connection corresponding to connection request has not been obtained from least one corresponding connection of the connection identifier to match,
The corresponding connection of connection request is then created, and the connection of creation is sent to user terminal, so that the application program of user terminal
According to the connection of creation connection corresponding with server foundation service.
In the 4th kind of possible embodiment provided based on the third possible embodiment, creation connection
After requesting corresponding connection, further includes:
By the corresponding connection of the connection identifier for being connected to matching of creation, and it is added to the connection pool constructed in advance
In.
In the 5th kind of possible embodiment provided based on the 4th kind of possible embodiment, by creation
It is connected to connection corresponding with the connection identifier to match, and before being added in the connection pool constructed in advance, further includes:
Judge whether the quantity of the corresponding connection of connection identifier to match reaches preset threshold;
If the quantity of the corresponding connection of the connection identifier to match is not up to preset threshold, execute the connection of creation
As connection corresponding with the connection identifier to match, and it is added to the step in the connection pool constructed in advance.
In the 6th kind of possible embodiment provided based on the 5th kind of possible embodiment, phase is judged
Whether the quantity of connection corresponding to the connection identifier matched reaches after preset threshold, further includes:
If the quantity of the corresponding connection of the connection identifier to match reaches preset threshold, phase is deleted from connection pool
At least one corresponding connection of the connection identifier matched, and execute the connection identifier for being connected to matching of creation is corresponding
Connection, and it is added to the step in the connection pool constructed in advance.
In the 7th kind of possible embodiment provided based on the first possible embodiment, in preparatory structure
Before the connection identifier that the determining connection identifier carried with connection request matches in the connection pool built, further includes:
Corresponding connection identifier is distributed for each service of application program, and is pre-created for each connection identifier corresponding
At least one connection;
According to each connection identifier and its at least one corresponding connection building connection pool.
In conclusion computer-readable medium provided in an embodiment of the present invention, by true in the connection pool constructed in advance
The connection identifier that the fixed connection identifier carried with the connection request got matches, and it is corresponding in the connection identifier to match
After obtaining the corresponding connection of connection request in connection, the connection that will acquire is sent to user terminal, so that user terminal is answered
Connection is established with program and server, when the corresponding connection of the connection request of application program has been pre-created in connection pool,
Without repeating creation connection, allows the connection pool constructed in advance to provide connection for multiple application programs, avoid server
The waste of connection resource improves the utilization rate of connection pool, reduces the cost of building connection pool.
It should be understood that the device provided by the above embodiment for establishing connection is when establishing connection, only with above-mentioned each function
Can module division progress for example, in practical application, can according to need and by above-mentioned function distribution by different functions
Module is completed, i.e., the internal structure for establishing the device of connection is divided into different functional modules, described above complete to complete
Portion or partial function.In addition, the device provided by the above embodiment for establishing connection belongs to the embodiment of the method for establishing connection
Same design, specific implementation process are detailed in embodiment of the method, and which is not described herein again.
The serial number of the above embodiments of the invention is only for description, does not represent the advantages or disadvantages of the embodiments.
Those of ordinary skill in the art will appreciate that realizing that all or part of the steps of above-described embodiment can pass through hardware
It completes, relevant hardware can also be instructed to complete by program, the program can store in a kind of computer-readable
In storage medium, storage medium mentioned above can be read-only memory, disk or CD etc..
The foregoing is merely presently preferred embodiments of the present invention, is not intended to limit the invention, it is all in spirit of the invention and
Within principle, any modification, equivalent replacement, improvement and so on be should all be included in the protection scope of the present invention.
Claims (12)
1. a kind of method for establishing connection, which is characterized in that applied in the device for establishing connection, and the dress for establishing connection
Set configuration in the user terminal, which comprises
The corresponding connection request of service provided by application program is obtained, is carried in the connection request opposite with the service
The connection identifier answered;
The connection identifier that the determining connection identifier carried with the connection request matches in the connection pool constructed in advance, it is described
The connection identifier to match corresponds at least one connection, and the connection pool constructed in advance includes for the clothes in the user terminal
The whole for being engaged in being pre-created connects;
If had not been obtained from least one corresponding connection of the connection identifier to match corresponding to the connection request
Connection, then create the corresponding connection of the connection request, and the connection of the creation is sent to the user terminal, so that institute
It states the application program of user terminal and the corresponding connection of the service is established according to the connection of the creation and server;
If there is connection corresponding with the connection request at least one corresponding connection of the connection identifier to match,
The corresponding connection of the connection request then is obtained from least one corresponding connection of the connection identifier to match, and will be obtained
The connection got is sent to the user terminal, so that the connection that the application program on the user terminal is got according to
The corresponding connection of the service is established with server.
2. the method according to claim 1, wherein the connection that will acquire be sent to user terminal it
Afterwards, further includes:
If it is corresponding that the connection that the application program of the user terminal is got according to server establishes the service
Connection failure, the then connection got described in deletion from the connection pool.
3. the method according to claim 1, wherein after the corresponding connection of the creation connection request,
Further include:
The creation is connected to connection corresponding with the connection identifier to match, and is added to the preparatory building
Connection pool in.
4. according to the method described in claim 3, it is characterized in that, described match being connected to for the creation with described
The corresponding connection of connection identifier, and before being added in the connection pool constructed in advance, further includes:
Whether the quantity of the corresponding connection of the connection identifier to match described in judgement reaches preset threshold;
If the quantity of the corresponding connection of connection identifier to match is not up to preset threshold, execute the creation
It is connected to connection corresponding with the connection identifier to match, and the step being added in the connection pool constructed in advance
Suddenly.
5. according to the method described in claim 4, it is characterized in that, corresponding to the connection identifier to match described in the judgement
Whether the quantity of connection reaches after preset threshold, further includes:
If the quantity of the corresponding connection of connection identifier to match reaches preset threshold, deleted from the connection pool
At least one corresponding connection of the connection identifier to match, and execute and being connected to for the creation matches with described
The corresponding connection of connection identifier, and the step being added in the connection pool constructed in advance.
6. the method according to claim 1, wherein the determining and company in the connection pool constructed in advance
Before connecing the connection identifier that matches of connection identifier that request carries, further includes:
Corresponding connection identifier is distributed for each service of the application program, and is pre-created for each connection identifier corresponding
At least one connection;
According to each connection identifier and its at least one corresponding connection building connection pool.
7. a kind of device for establishing connection, which is characterized in that described device configures in the user terminal, and described device includes:
First obtains module, for obtaining the corresponding connection request of service provided by application program, takes in the connection request
With connection identifier corresponding with the service;
Determining module, for determining that the connection request got with the first acquisition module is taken in the connection pool constructed in advance
The connection identifier that the connection identifier of band matches, the connection identifier to match correspond at least one connection, the preparatory structure
The connection pool built includes the whole connections being pre-created for the service in the user terminal;
Second obtains module, if for existing and the company at least one corresponding connection of the connection identifier to match
The corresponding connection of request is connect, then is obtained from least one corresponding connection of the connection identifier to match that the determining module determines
Take the corresponding connection of the connection request;
First sending module, the connection for getting the second acquisition module is sent to the user terminal, so that institute
It states connection that the application program on user terminal is got according to and server and establishes the corresponding connection of the service;
First creation module, if for having not been obtained from least one corresponding connection of the connection identifier to match to institute
The corresponding connection of connection request is stated, then creates the corresponding connection of the connection request;
Second sending module, the connection for creating first creation module is sent to the user terminal, so that described
The application program of user terminal establishes the corresponding connection of the service according to the connection of the creation and server.
8. device according to claim 7, which is characterized in that described device further include:
First removing module, connection and server for getting according in the application program of the user terminal are established
When the corresponding connection failure of the service, deleted from the connection pool described in the connection that gets.
9. device according to claim 8, which is characterized in that described device further include:
Adding module, it is corresponding with the connection identifier to match for being connected to of creating first creation module
Connection, and be added in the connection pool constructed in advance.
10. device according to claim 9, which is characterized in that described device further include:
Judgment module, for judging whether the quantity of the corresponding connection of connection identifier to match reaches preset threshold, and
When the quantity of the corresponding connection of the connection identifier to match is not up to preset threshold, then the adding module.
11. device according to claim 10, which is characterized in that described device further include:
Second removing module judges that the quantity of the corresponding connection of connection identifier to match reaches default for the judgment module
When threshold value, at least one corresponding connection of the connection identifier to match described in deletion from the connection pool, and add described in execution
Add module.
12. device according to claim 7, which is characterized in that described device further include:
Distribution module, for distributing corresponding connection identifier for each service of the application program;
At least one corresponding company is pre-created in second creation module, each connection identifier for distributing for the distribution module
It connects;
Module is constructed, each connection identifier and second creation module for distributing according to the distribution module create every
At least one corresponding connection building connection pool of a connection identifier.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310172564.9A CN104142868B (en) | 2013-05-10 | 2013-05-10 | Establish the method and device of connection |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310172564.9A CN104142868B (en) | 2013-05-10 | 2013-05-10 | Establish the method and device of connection |
Publications (2)
Publication Number | Publication Date |
---|---|
CN104142868A CN104142868A (en) | 2014-11-12 |
CN104142868B true CN104142868B (en) | 2019-05-07 |
Family
ID=51852049
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310172564.9A Active CN104142868B (en) | 2013-05-10 | 2013-05-10 | Establish the method and device of connection |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104142868B (en) |
Families Citing this family (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106469156B (en) * | 2015-08-17 | 2019-10-18 | 华为终端有限公司 | Data base read-write method and device |
CN105956000B (en) * | 2016-04-20 | 2019-09-27 | 广州华多网络科技有限公司 | A kind of data interactive method and client |
CN107885537A (en) * | 2016-09-28 | 2018-04-06 | 平安科技(深圳)有限公司 | Configuration file loading method and device |
CN107995233B (en) * | 2016-10-26 | 2021-12-17 | 阿里巴巴集团控股有限公司 | Method for establishing connection and corresponding equipment |
CN108932948B (en) * | 2017-05-26 | 2021-12-14 | 腾讯科技(深圳)有限公司 | Audio data processing method and device, computer equipment and computer readable storage medium |
CN107547634B (en) * | 2017-07-28 | 2020-11-03 | 新华三信息安全技术有限公司 | Session management method and device |
CN108156488A (en) * | 2017-12-22 | 2018-06-12 | 北京数码视讯软件技术发展有限公司 | Interactive approach and electronic equipment based on gateway server |
CN108366004B (en) * | 2018-02-07 | 2021-02-05 | 北京奇艺世纪科技有限公司 | Connection method and connection system of intelligent sound box and controlled equipment |
CN110493353A (en) * | 2019-09-05 | 2019-11-22 | 香港乐蜜有限公司 | Communication means, device and server |
CN111131407B (en) * | 2019-12-09 | 2021-05-11 | 深圳市盛铂科技有限公司 | Network equipment connection method and network equipment |
CN110971703B (en) * | 2019-12-11 | 2020-12-25 | 腾讯科技(深圳)有限公司 | Service request method, device, server and storage medium based on connection pool |
CN115568036B (en) * | 2022-10-14 | 2023-10-20 | 荣耀终端有限公司 | Application connection method, electronic equipment, chip and storage medium |
CN117539949B (en) * | 2024-01-10 | 2024-04-12 | 腾讯科技(深圳)有限公司 | Processing method and device of database access request, electronic equipment and storage medium |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102957627A (en) * | 2012-11-19 | 2013-03-06 | 浪潮电子信息产业股份有限公司 | Method for improving data transmission efficiency on basis of TCP (Transmission Control Protocol) long connection |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101309233B (en) * | 2008-06-04 | 2010-09-08 | 腾讯科技(深圳)有限公司 | Method realizing TCP connection reusing in instant communication |
US20100036957A1 (en) * | 2008-08-08 | 2010-02-11 | Oracle International Corporation | Method and System for Implementing Transfer of a Network Session |
CN101447993B (en) * | 2008-12-23 | 2012-01-25 | 深圳市金蝶中间件有限公司 | Method and device for finding unreleased connection in connection pool |
-
2013
- 2013-05-10 CN CN201310172564.9A patent/CN104142868B/en active Active
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102957627A (en) * | 2012-11-19 | 2013-03-06 | 浪潮电子信息产业股份有限公司 | Method for improving data transmission efficiency on basis of TCP (Transmission Control Protocol) long connection |
Also Published As
Publication number | Publication date |
---|---|
CN104142868A (en) | 2014-11-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104142868B (en) | Establish the method and device of connection | |
CN106454404B (en) | A kind of methods, devices and systems playing live video | |
CN104780164B (en) | A kind of method and apparatus of running game client | |
CN104618217B (en) | Share method, terminal, server and the system of resource | |
CN104639672B (en) | The method and apparatus for carrying out domain name mapping | |
US10069818B2 (en) | Method, system, device, and terminal for network initialization of multimedia playback device | |
CN105025043B (en) | Information sharing method, apparatus and system | |
CN103294515B (en) | A kind of methods, devices and systems for obtaining application program | |
CN106791892A (en) | It is a kind of to take turns the live methods, devices and systems of wheat | |
CN106791955B (en) | A kind of method and system of determining live streaming duration | |
CN106161176A (en) | Cluster conversation message treatment method and device | |
CN104252341B (en) | The client device of the skin change method of application program, device and application program | |
CN103179026B (en) | Communication means in user interactive system, system and server and client side | |
CN103886198B (en) | Method, terminal, server and the system that a kind of data process | |
CN105491135B (en) | Establish the method and device of data connection | |
CN104516624B (en) | A kind of method and device inputting account information | |
CN106303605B (en) | A kind of methods, devices and systems to send a notification message | |
CN106254910A (en) | A kind of method and apparatus recording image | |
CN106658657A (en) | Network access method and device | |
CN103491421B (en) | Content displaying method, device and intelligent television | |
CN104660769B (en) | A kind of methods, devices and systems for adding associated person information | |
CN104917905B (en) | Processing method, terminal and the server of Stranger Calls | |
CN104092657B (en) | Method, equipment and the system of information transmission | |
CN106210838B (en) | Caption presentation method and device | |
CN105553718B (en) | Guidance information display methods and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |