CN107094310A - The method for connecting network and system of application in a kind of mobile terminal - Google Patents
The method for connecting network and system of application in a kind of mobile terminal Download PDFInfo
- Publication number
- CN107094310A CN107094310A CN201710324856.8A CN201710324856A CN107094310A CN 107094310 A CN107094310 A CN 107094310A CN 201710324856 A CN201710324856 A CN 201710324856A CN 107094310 A CN107094310 A CN 107094310A
- Authority
- CN
- China
- Prior art keywords
- data server
- thread
- application
- newly
- interface channel
- 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.)
- Granted
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W36/00—Hand-off or reselection arrangements
- H04W36/0005—Control or signalling for completing the hand-off
- H04W36/0011—Control or signalling for completing the hand-off for data sessions of end-to-end connection
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W36/00—Hand-off or reselection arrangements
- H04W36/24—Reselection being triggered by specific parameters
- H04W36/30—Reselection being triggered by specific parameters by measured or perceived connection quality data
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W76/00—Connection management
- H04W76/10—Connection setup
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Mobile Radio Communication Systems (AREA)
Abstract
The invention discloses the method for connecting network applied in a kind of mobile terminal and system, wherein, there is first thread and the second thread in the application, methods described includes:Second thread sends network connection test request according to predetermined period to data server, to obtain the application and the current network state between the data server, and feeds back the current network state to the first thread;The first thread is in the message generated in receiving the application, the current network state fed back according to second thread, judges whether to need the newly-built application and the interface channel between the data server;The first thread sends the message received to the data server according to the result of judgement.The method for connecting network and system of application in the mobile terminal that the present invention is provided, can promptly recover communication when network switches.
Description
Technical field
The method for connecting network of application and it is the present invention relates to Internet technical field, in more particularly to a kind of mobile terminal
System.
Background technology
With continuing to develop for mobile device, people increasingly get used to being engaged in vairious activities on the mobile apparatus.Currently,
The network connection state of mobile device would generally change with the change of position.For example, indoors when, mobile device generally may be used
To connect WiFi, and at outdoor, mobile device then with 2G/3G/4G network connections.
At present, in mobile device application (Application, APP) is in network switching process, it usually needs wait compared with
The long time could recover normal communication.Reason is, one is there is normally only in current APP and is responsible for and data server
Enter the thread of row data communication, message directly can be sent to number by the thread when receiving message by existing interface channel
According to server.But, when network switching, existing interface channel will be unable to be connected to data server, so, in message hair
Send after time-out, thread just understands newly-built interface channel, and the message is sent again.The longer stand-by period can be so caused, so that nothing
Method promptly recovers normal communication in network switching.
The content of the invention
In order to solve problem of the prior art, the embodiments of the invention provide the network connection applied in a kind of mobile terminal
Method and system.The technical scheme is as follows:
On the one hand, there is first thread and second in the application in the method for connecting network applied in a kind of mobile terminal
Thread, methods described includes:
Second thread sends network connection test request according to predetermined period to data server, to obtain described answer
The current network state is fed back with the current network state between the data server, and to the first thread;
The first thread is in the message generated in receiving the application, according to the current of second thread feedback
Network state, judges whether to need the newly-built application and the interface channel between the data server;
The first thread sends the message received to the data server according to the result of judgement.
Further, second thread obtains the application and the current network state bag between the data server
Include:
When in preset time period, when the network connection test request sent to the data server is not responded, really
The fixed application is not connect with the current network state between the data server;
When the network connection test request sent to the data server is responded by the data server, institute is determined
It is to connect to state using with the current network state between the data server.
Further, the first thread judges whether to need the newly-built application and the company between the data server
Connecting road includes:
When the current network state is not connect, the newly-built application of first thread and the data server
Between interface channel;
When the current network state for connection when, the first thread using it is described application and the data server it
Between established connection passage.
Further, the first thread sends the message received to the data according to the result of judgement
Server includes:
When the newly-built application of the first thread is with interface channel between the data server, by what is received
The message is sent to the data server by newly-built interface channel;
When the not newly-built application of the first thread is with interface channel between the data server, it will receive
The message by it is described application and established connection passage between the data server send to the data take
It is engaged at device.
Further, methods described also includes:
After interface channel between the newly-built application of the first thread and the data server, described second
Thread sends network connection test request, to obtain newly-built connection by newly-built interface channel to the data server
The corresponding current network state of passage.
On the other hand, a kind of network connection system applied in mobile terminal, the system includes first thread and second
Thread, wherein:
Second thread, for sending network connection test request to data server according to predetermined period, to obtain
The application and the current network state between the data server, and feed back the current network shape to the first thread
State;
The first thread, in the message generated in receiving the application, being fed back according to second thread
Current network state, judge whether need it is newly-built it is described application and the interface channel between the data server;According to sentencing
Disconnected result, the message received is sent to the data server.
Further, second thread is additionally operable to:
When in preset time period, when the network connection test request sent to the data server is not responded, really
The fixed application is not connect with the current network state between the data server;
When the network connection test request sent to the data server is responded by the data server, institute is determined
It is to connect to state using with the current network state between the data server.
Further, the first thread is additionally operable to:
When the current network state for when not connecting, the newly-built application is led to the connection between the data server
Road;
When the current network state is connection, using the application with having built up between the data server
Interface channel.
Further, the first thread is additionally operable to:
When the newly-built application is with interface channel between the data server, the message received is passed through
Newly-built interface channel is sent to the data server;
When the not newly-built application is with interface channel between the data server, the message received is led to
The application is crossed to send to the data server with established connection passage between the data server.
Further, second thread is additionally operable to:
After interface channel between the newly-built application of the first thread and the data server, described second
Thread sends network connection test request, to obtain newly-built connection by newly-built interface channel to the data server
The corresponding current network state of passage.
Beneficial effects of the present invention at least include:
The present invention sets two threads in APP, wherein, first thread is responsible for the transmission of message, and the second thread is then continuous
Ground detects the current network state between APP and data server, and the network state of detection is fed back into first thread.So
When first thread is ready for sending message, current network state can be checked first, if current network state is does not connect, newly
Build the transmission that interface channel carries out message;If current network state is connection, message can be directly transmitted.So just can be with
Avoid sending the stand-by period of time-out, so as to can promptly recover normal communication in network switching.
Brief description of the drawings
Technical scheme in order to illustrate the embodiments of the present invention more clearly, makes required in being described below to embodiment
Accompanying drawing is briefly described, it should be apparent that, drawings in the following description are only some embodiments of the present invention, for
For those of ordinary skill in the art, on the premise of not paying creative work, other can also be obtained according to these accompanying drawings
Accompanying drawing.
Fig. 1 is the method for connecting network flow chart of the interior application of mobile terminal in embodiment of the present invention;
Fig. 2 is the structural representation of the network connection system of the interior application of mobile terminal in embodiment of the present invention.
Embodiment
To make the object, technical solutions and advantages of the present invention clearer, below in conjunction with accompanying drawing to embodiment party of the present invention
Formula is described in further detail.
Referring to Fig. 1, the application provides a kind of method for connecting network of application in mobile terminal, there is the in the application
One thread and the second thread, methods described include:
S1:Second thread sends network connection test request according to predetermined period to data server, to obtain
Application and the current network state between the data server are stated, and the current network shape is fed back to the first thread
State;
S2:The first thread is fed back in the message generated in receiving the application according to second thread
Current network state, judges whether to need the newly-built application and the interface channel between the data server;
S3:The first thread sends the message received to the data server according to the result of judgement.
In the present embodiment, second thread obtains the application and the current network between the data server
State includes:
When in preset time period, when the network connection test request sent to the data server is not responded, really
The fixed application is not connect with the current network state between the data server;
When the network connection test request sent to the data server is responded by the data server, institute is determined
It is to connect to state using with the current network state between the data server.
In the present embodiment, the first thread judge whether need it is newly-built it is described application and the data server it
Between interface channel include:
When the current network state is not connect, the newly-built application of first thread and the data server
Between interface channel;
When the current network state for connection when, the first thread using it is described application and the data server it
Between established connection passage.
In the present embodiment, the first thread sends the message received to institute according to the result of judgement
Stating data server includes:
When the newly-built application of the first thread is with interface channel between the data server, by what is received
The message is sent to the data server by newly-built interface channel;
When the not newly-built application of the first thread is with interface channel between the data server, it will receive
The message by it is described application and established connection passage between the data server send to the data take
It is engaged at device.
In the present embodiment, methods described also includes:
After interface channel between the newly-built application of the first thread and the data server, described second
Thread sends network connection test request, to obtain newly-built connection by newly-built interface channel to the data server
The corresponding current network state of passage.
Specifically, in a practical application scene, the second thread can be by existing interface channel, constantly to number
Packet is sent according to server.If effectively, data server just can receive packet to existing interface channel, receiving
To after packet, data server can be with feedback response packet.So, the second thread is after response data packet is received,
Show that data server can be responded, so as to show that current interface channel is connection, it may be determined that current network shape
State is connection.And if data server does not all have feedback response packet within a period of time, then show that current connection is led to
Road has failed, and the second thread can be determined that current network state not connect.
When the second thread gets current network state, current network state can be fed back to first thread in real time.This
Sample, when first thread is ready for sending message, can check the current network state of the second thread feedback.If the current network
State is connection, then shows that network does not switch, established connection passage can still be used.So, First Line
Journey just directly can send a message to data server by the interface channel set up.And if the current network state
Not connect, then show that network is switched, the interface channel set up before has failed, now first thread can be with newly-built
Interface channel between APP and data server, and message is sent by newly-built interface channel, so that message can also be sent out
Deliver at data server.Therefore, such processing mode avoids the stand-by period that message sends time-out, is cut in network
Normal communication can promptly be recovered when changing.Through actual measurement, according to the scheme of single thread in the prior art, in network switching,
It is generally necessary to when communication could be recovered within 10 seconds;And the technical scheme of the application is in network switching, it is only necessary to wait 0.5 to 2
It second just can recover communication.
Referring to Fig. 2, the application also provides a kind of network connection system of application in mobile terminal, the system includes the
One thread 100 and the second thread 200, wherein:
Second thread, for sending network connection test request to data server according to predetermined period, to obtain
The application and the current network state between the data server, and feed back the current network shape to the first thread
State;
The first thread, in the message generated in receiving the application, being fed back according to second thread
Current network state, judge whether need it is newly-built it is described application and the interface channel between the data server;According to sentencing
Disconnected result, the message received is sent to the data server.
In the present embodiment, second thread is additionally operable to:
When in preset time period, when the network connection test request sent to the data server is not responded, really
The fixed application is not connect with the current network state between the data server;
When the network connection test request sent to the data server is responded by the data server, institute is determined
It is to connect to state using with the current network state between the data server.
In the present embodiment, the first thread is additionally operable to:
When the current network state for when not connecting, the newly-built application is led to the connection between the data server
Road;
When the current network state is connection, using the application with having built up between the data server
Interface channel.
In the present embodiment, the first thread is additionally operable to:
When the newly-built application is with interface channel between the data server, the message received is passed through
Newly-built interface channel is sent to the data server;
When the not newly-built application is with interface channel between the data server, the message received is led to
The application is crossed to send to the data server with established connection passage between the data server.
In the present embodiment, second thread is additionally operable to:
After interface channel between the newly-built application of the first thread and the data server, described second
Thread sends network connection test request, to obtain newly-built connection by newly-built interface channel to the data server
The corresponding current network state of passage.
Beneficial effects of the present invention at least include:
The present invention sets two threads in APP, wherein, first thread is responsible for the transmission of message, and the second thread is then continuous
Ground detects the current network state between APP and data server, and the network state of detection is fed back into first thread.So
When first thread is ready for sending message, current network state can be checked first, if current network state is does not connect, newly
Build the transmission that interface channel carries out message;If current network state is connection, message can be directly transmitted.So just can be with
Avoid sending the stand-by period of time-out, so as to can promptly recover normal communication in network switching.
Through the above description of the embodiments, those skilled in the art can be understood that each embodiment can
Realized by the mode of software plus required general hardware platform, naturally it is also possible to pass through hardware.Understood based on such, on
The part that technical scheme substantially in other words contributes to prior art is stated to embody in the form of software product, should
Computer software product can be stored in a computer-readable storage medium, such as ROM/RAM, magnetic disc, CD, including some fingers
Order is to cause a computer equipment (can be personal computer, server, or network equipment etc.) to perform each implementation
Method described in some parts of example or embodiment.
The foregoing is only presently preferred embodiments of the present invention, be not intended to limit the invention, it is all the present invention spirit and
Within principle, any modification, equivalent substitution and improvements made etc. should be included in the scope of the protection.
Claims (10)
1. the method for connecting network of application in a kind of mobile terminal, it is characterised in that there is first thread and the in the application
Two threads, methods described includes:
Second thread according to predetermined period to data server send network connection test request, with obtain it is described application with
Current network state between the data server, and feed back the current network state to the first thread;
The first thread is in the message generated in receiving the application, the current network fed back according to second thread
State, judges whether to need the newly-built application and the interface channel between the data server;
The first thread sends the message received to the data server according to the result of judgement.
2. according to the method described in claim 1, it is characterised in that second thread obtains the application and taken with the data
Current network state between business device includes:
When in preset time period, when the network connection test request sent to the data server is not responded, institute is determined
It is not connect to state using with the current network state between the data server;
When the network connection test request sent to the data server is responded by the data server, it is determined that described should
It is to connect with the current network state between the data server.
3. according to the method described in claim 1, it is characterised in that the first thread judges whether to need the newly-built application
Interface channel between the data server includes:
When the current network state for when not connecting, the newly-built application of the first thread between the data server
Interface channel;
When the current network state for connection when, the first thread using it is described application between the data server
The interface channel being set up.
4. method according to claim 3, it is characterised in that the first thread will be received according to the result of judgement
The message send to the data server and include:
When the newly-built application of the first thread is with interface channel between the data server, described in receiving
Message is sent to the data server by newly-built interface channel;
When the not newly-built application of the first thread is with interface channel between the data server, by the institute received
Message is stated to send to the data server with established connection passage between the data server by the application
Place.
5. according to the method described in claim 1, it is characterised in that methods described also includes:
After interface channel between the newly-built application of the first thread and the data server, second thread
By newly-built interface channel, network connection test request is sent to the data server, to obtain newly-built interface channel
Corresponding current network state.
6. the network connection system of application in a kind of mobile terminal, it is characterised in that the system includes first thread and second
Thread, wherein:
Second thread, it is described to obtain for sending network connection test request to data server according to predetermined period
The current network state is fed back using the current network state between the data server, and to the first thread;
The first thread, in the message generated in receiving the application, according to working as that second thread feeds back
Preceding network state, judges whether to need the newly-built application and the interface channel between the data server;According to judgement
As a result, the message received is sent to the data server.
7. system according to claim 6, it is characterised in that second thread is additionally operable to:
When in preset time period, when the network connection test request sent to the data server is not responded, institute is determined
It is not connect to state using with the current network state between the data server;
When the network connection test request sent to the data server is responded by the data server, it is determined that described should
It is to connect with the current network state between the data server.
8. system according to claim 6, it is characterised in that the first thread is additionally operable to:
When the current network state is not connect, the newly-built application and the interface channel between the data server;
When the current network state is connection, the application and established connection between the data server are used
Passage.
9. system according to claim 8, it is characterised in that the first thread is additionally operable to:
When the newly-built application is with interface channel between the data server, the message received is passed through newly-built
Interface channel send to the data server;
When the not newly-built application is with interface channel between the data server, the message received is passed through into institute
State to apply and sent with established connection passage between the data server to the data server.
10. system according to claim 6, it is characterised in that second thread is additionally operable to:
After interface channel between the newly-built application of the first thread and the data server, second thread
By newly-built interface channel, network connection test request is sent to the data server, to obtain newly-built interface channel
Corresponding current network state.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710324856.8A CN107094310B (en) | 2017-05-09 | 2017-05-09 | A kind of method for connecting network and system of the interior application of mobile terminal |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710324856.8A CN107094310B (en) | 2017-05-09 | 2017-05-09 | A kind of method for connecting network and system of the interior application of mobile terminal |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107094310A true CN107094310A (en) | 2017-08-25 |
CN107094310B CN107094310B (en) | 2018-08-10 |
Family
ID=59638536
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710324856.8A Active CN107094310B (en) | 2017-05-09 | 2017-05-09 | A kind of method for connecting network and system of the interior application of mobile terminal |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107094310B (en) |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR20050062319A (en) * | 2003-12-18 | 2005-06-23 | 한국전자통신연구원 | Method for composing services staticaly in open network and system therefor |
KR100679563B1 (en) * | 2005-09-01 | 2007-02-06 | 주식회사 엘지텔레콤 | Communication device of co-owning contents file with other devices and method for operating the communication device |
KR20090027596A (en) * | 2007-09-12 | 2009-03-17 | 아바야 인코포레이티드 | Signature-free intrusion detection |
CN101448270A (en) * | 2008-12-23 | 2009-06-03 | 中兴通讯股份有限公司 | Method and system for realizing dynamic flow control by network element signaling tracking |
KR20100007415A (en) * | 2008-07-14 | 2010-01-22 | 포스데이타 주식회사 | Method of authentication for interworking wimax/wibro mobile communication network with digital subscriber line network and wimax/wibro mobile communication system thereof |
CN103701932A (en) * | 2014-01-09 | 2014-04-02 | 北京交通大学 | Method of data transmission in internet of things |
CN106302459A (en) * | 2016-08-16 | 2017-01-04 | 网易(杭州)网络有限公司 | Networking operational approach and device |
-
2017
- 2017-05-09 CN CN201710324856.8A patent/CN107094310B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR20050062319A (en) * | 2003-12-18 | 2005-06-23 | 한국전자통신연구원 | Method for composing services staticaly in open network and system therefor |
KR100679563B1 (en) * | 2005-09-01 | 2007-02-06 | 주식회사 엘지텔레콤 | Communication device of co-owning contents file with other devices and method for operating the communication device |
KR20090027596A (en) * | 2007-09-12 | 2009-03-17 | 아바야 인코포레이티드 | Signature-free intrusion detection |
KR20100007415A (en) * | 2008-07-14 | 2010-01-22 | 포스데이타 주식회사 | Method of authentication for interworking wimax/wibro mobile communication network with digital subscriber line network and wimax/wibro mobile communication system thereof |
CN101448270A (en) * | 2008-12-23 | 2009-06-03 | 中兴通讯股份有限公司 | Method and system for realizing dynamic flow control by network element signaling tracking |
CN103701932A (en) * | 2014-01-09 | 2014-04-02 | 北京交通大学 | Method of data transmission in internet of things |
CN106302459A (en) * | 2016-08-16 | 2017-01-04 | 网易(杭州)网络有限公司 | Networking operational approach and device |
Also Published As
Publication number | Publication date |
---|---|
CN107094310B (en) | 2018-08-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN1783787B (en) | Monitoring control system and method | |
CN102651701B (en) | Set up the method and apparatus that audio/video communication connects | |
CN102014019B (en) | Aggregated link switching method and device | |
CN105323080B (en) | A kind of link backup, power supply backup method, apparatus and system | |
CN105099791B (en) | A kind of terminal fault localization method and system based on network signal monitoring data | |
CN105072021B (en) | A kind of message forwarding method of dispatch automated system cross-network segment | |
CN107360239A (en) | A kind of client connection status detection method and system | |
CN104518936B (en) | Link dynamic aggregation method and apparatus | |
CN105871651A (en) | Device connectivity monitoring method and device | |
CN102088372A (en) | Heartbeat detecting method, system and equipment | |
CN105591846A (en) | Driving control method and driving control device | |
CN109150766A (en) | The method and apparatus of dynamic addressing server in local area network based on UDP multicast | |
CN103259687A (en) | Air traffic control data access platform in civil aviation | |
CN103051484B (en) | Session service processing method, system and Session Border Controll | |
CN105553865B (en) | A kind of FC exchanger chips credit management test method | |
Kim et al. | Traffic monitoring system for 5G core network | |
CN106878117A (en) | A kind of data processing method and device | |
CN107094310A (en) | The method for connecting network and system of application in a kind of mobile terminal | |
CN104581796B (en) | A kind of sending method, CSE and the system of M2M application request | |
CN106534331B (en) | A kind of data transmission method and system based on dynamic port switching | |
WO2018014882A1 (en) | Method and device for acquiring router information, and router addressing apparatus and system | |
CN103873594A (en) | Service switching method and system | |
CN101800667A (en) | Alarm message transmitting method, network equipment and alarm system | |
CN103684831A (en) | Method, device and system for protecting L2TP network | |
CN106921807B (en) | A kind of telephone operation machine system and its self checking method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
CP03 | Change of name, title or address |
Address after: 510000 unit 03-05, room 1601, No. 12, Zhujiang East Road, Tianhe District, Guangzhou City, Guangdong Province (office use only) Patentee after: Guangzhou saiyiyecai Technology Co.,Ltd. Address before: 510000 unit 03-05, room 1601, No. 12, Zhujiang East Road, Tianhe District, Guangzhou, Guangdong Patentee before: GUANGZHOU ENERGY BOX TECHNOLOGY Co.,Ltd. |
|
CP03 | Change of name, title or address |