Embodiment
For making the purpose, technical solutions and advantages of the present invention clearer, embodiment of the present invention is described further in detail below in conjunction with accompanying drawing.
The method of network connection of the embodiment of the invention can run on the operating system platform that is used for portable removable smart machine that the exploitation of Android(Google is installed), the operating system platform that is used for portable removable smart machine of iOS(Apple exploitation), the operating system platform that is used for portable removable smart machine of Windows Phone(Microsoft exploitation) terminal of operating system such as, this terminal can be a mobile phone, palmtop PC, in panel computer or the like any one, can comprise central processing unit in this terminal, memory, switching device, power supply, the clock signal maker, image processor, combination in any in the Sound Processor Unit etc., above-mentioned central processing unit, memory, switching device, power supply, the clock signal maker, image processor, combination in any in the Sound Processor Unit etc. is used for realizing the function of the method for network connection of embodiments of the invention.
First and second execution sequences of not representing successively that relate in the present embodiment are just in order to illustrate each self-corresponding information of distinct device.
Embodiment one
Referring to Fig. 1, the method that provides a kind of network to share in the present embodiment comprises:
101, receive the default call request of using network;
102, obtain current network connection type;
103, when described current network connection type is the connection of personal computer PC shared network, described PC shared network is converted to default network, makes described default application know that local network is connected to described default network connection and allows calling of described default application.
In another embodiment, describedly obtain current network connection type, comprising:
When described call request during, obtain current network connection type from application layer.
In another embodiment, described described PC shared network is converted to default network, comprises:
Call default application programming interfaces;
By described preset interface the sign of described PC shared network is revised as the sign of default network, to realize that described PC shared network is converted to described default network.
In another embodiment, described default network comprises: Wireless Fidelity WI-FI network.
In another embodiment, described method also comprises:
When receiving the request of creating the PC shared network, enable the network share service of general-purpose serial bus USB, set up shared network local and the PC end.
In another embodiment, the shared network of described foundation and PC end comprises:
Create telecommunication network driving interface standard RNDIS network interface card, and will return the message of creating described RNDIS network interface card to the PC end, PC being held the network of described PC end is shared the dynamic host configuration protocol DHCP function of giving described RNDIS network interface card and closing described RNDIS network interface card, is terminal distribution the 2nd RNDIS network information and DNS information also with the RNDIS network information that described PC end is set;
Receive the configuration order that described PC end issues, described configuration order comprises: described the 2nd RNDIS network information and described DNS information;
According to described configuration order described the 2nd RNDIS network information and DNS information are set on described terminal, to set up the shared network of local and described PC end.
In another embodiment, described method also comprises:
When receiving the request that disconnects the PC shared network, the network share service of removing to enable USB disconnects shared network local and the PC end.
In another embodiment, the shared network of described disconnection and PC end comprises:
Deletion RNDIS network interface card, and will return the message of deleting described RNDIS network interface card to the PC end makes reset described RNDIS network interface card and remove the shared relationship of described PC end network and described RNDIS network interface card of PC end.
The beneficial effect of present embodiment is: receive the default call request of using network; Obtain current network connection type; When described current network connection type is the connection of PC shared network, described PC shared network is converted to default network, make described should preset to use know that local network is connected to described default network and connects and allow calling of described default application, thereby solved the problem that current some application program can not normally be used in the PC shared network.
Embodiment two
The method that provides a kind of network to share in the embodiment of the invention, only support the problem of certain type network at present part A PP, in the present embodiment when the user is in the PC shared network and connects, when triggering the application of APP, the PC shared network is converted to the default network that APP can support, so just can realizes normal used of APP in the PC shared network.The system that terminal is used in the present embodiment includes but not limited to: Android system etc., this present embodiment is not done concrete qualification.In the present embodiment, default network type includes but not limited to: data connection and/or WI-FI connection etc., this present embodiment is not done concrete qualification.Be that WI-FI is connected to example and describes with the default network type of supporting of using in the present embodiment.
Referring to Fig. 2, method flow comprises:
201, when the default application on the terminal is triggered, the default application to the call request of network connection service module transmission to network.
Whether in this step, default being applied in before the execution inquired about current network type earlier, determine to continue to carry out according to the current network type again.Concrete, after default application is triggered, initiate function call request to the network connection service module by the application layer of system, whether be the network connection type that default application can be supported to check current network connection type.
In the concrete implementation, application layer includes but not limited to the function call request that the network connection service module sends: check whether connection requests of WI-FI, or check the request of current activation network type, this present embodiment is not done concrete qualification.
202, the network connection service module receives the default call request of using network, and whether judges this call request from application layer, if then obtain local network connection type.
In this step, when receiving function call request, earlier judge that whether this function is from application layer, if this function call is from application layer, then obtain current network connection type,, then function call request is handled by present mode if this function call is from system, similar with correlation technique herein, this is repeated no more in the present embodiment.
203, when described current network connection type is the connection of PC shared network, described PC shared network is converted to default network, makes described default application know that local network is connected to described default network connection and allows calling of described default application.
In the present embodiment, the PC shared network is converted to default network, comprises: call default application programming interfaces; By described preset interface the sign of described PC shared network is revised as the sign of default network, to realize that described PC shared network is converted to described default network.Wherein, the interface of default application program comprises the interface relevant with network connection type.
In the present embodiment, after the network connection service module is revised as the sign of PC shared network default network identity, to inform that by preset interface application layer current network type is the WI-FI network, when application layer knows that current network connection type is the WI-FI connection type, this network type is informed default the application, default like this being applied in known when the current network type is the WI-FI network, just can call function wherein, makes default application normally to use.
The beneficial effect of present embodiment is: receive the default call request of using network; Obtain current network connection type; When described current network connection type is the connection of PC shared network, described PC shared network is converted to default network, make described should preset to use know that local network is connected to described default network and connects and allow calling of described default application, thereby solved the problem that current some application program can not normally be used in the PC shared network.
Embodiment three
The method that provides a kind of network to share in the embodiment of the invention is connected by data wire terminal with the PC end, do not need the user that network parameter manually is set, and only needs to trigger the PC shared network sign of PC end, just enough can trigger the PC end and be connected with the network of terminal.Wherein, the shared network that terminal and PC end is created in the foregoing description two can be to create by the method in the present embodiment, also can be the PC shared network of creating by other method, and this present embodiment is not done concrete qualification.
Referring to Fig. 3, method flow comprises:
301, the PC shared network service module of PC end on terminal sends the request of creating the PC shared network.
In the present embodiment, the sign of PC shared network is set at the PC end, when the user triggers this sign, the PC end initiates to create the request of PC shared network to terminal by USB, comprise in this request and enable the order that PC shares online, make PC shared network service module when receiving request to create, enable the network share service of USB.
302, PC shared network service module receives the request of creating the PC shared network, enables the network share service of USB.
303, the network connection service module creation RNDIS(Remote Network Driver Interface Specification on the terminal, telecommunication network driving interface standard) network interface card.
In this step, PC shared network service module is when receiving request to create, and informing network Connection Service module is opened the network share service of USB, and creates the RNDIS network interface card, returns the message that the RNDIS network interface card has been created to the PC end simultaneously.
304, the notice of the network connection service module on terminal PC end RNDIS network interface card is created.
305, the PC end shares local network to the RNDIS network interface card, and closes the DHCP(Dynamic Host Configuration Protocol of this network interface card, and DynamicHost is provided with agreement) function.
306, the PC end is provided with the local RNDIS network information.
Wherein, the RNDIS network information comprises network IP etc., and is similar with correlation technique herein, and this present embodiment is repeated no more.
307, the PC end is the terminal distribution RNDIS network information, and obtains relevant DNS information.
308, the PC end issues the configuration order of PC shared network to terminal.
In the present embodiment, PC end is the terminal distribution RNDIS network information, and obtains DNS information, and the mode by configuration order is handed down to terminal.
309, PC network share service module is provided with the RNDIS network information and corresponding D NS according to the configuration order that receives.
Wherein, the process that the RNDIS network information is set is the process of change terminal default gateway.
310, PC network share service module informing network connection management service module PC shared network successful connection.
311, the network connection management service module of terminal is updated to the shared online of PC with the current network connection status, and the variation of notice application layer network connection state.
In the present embodiment, start after the connection of PC shared network, the variation of notice application layer network connection state makes application layer upgrade the sign of current network connection status, the user knows that by the connection identifier of this network state current network connects, can surf the Net.
In the present embodiment, after having created the shared online connection of PC, the flow process that terminal IP packet is externally transmitted comprises: 1) terminal forwarding IP packet; 2) the IP packet sends to the default gateway of RNDIS network interface and terminal network through the RNDIS network interface; 3) the network connection service module is intercepted and captured the IP packet at default gateway place, and the IP packet is forwarded to the local network connection of PC end.Wherein, terminal receives the flow process of IP packet for transmitting the adverse current journey of packet, repeats no more in this present embodiment.
In the present embodiment,, when the user closes the shared online of PC, can start following flow process referring to Fig. 4:
1, the PC end sends to PC network share service module by USB interface and goes to enable the shared online order of PC;
In this step, the user triggers PC and shares online and close sign, after the PC end detects this sign and is triggered, sends to PC network share service module and to close the request that PC shares online, comprises in this request that enabling PC shares online order.
2, the shared service on net module of the PC on the terminal receives and goes to enable the shared online order of PC, and informing network Connection Service module is closed USB shared network function;
3, network connection service module deletion RNDIS network interface card upgrades current network connection state, the variation of notifying the application layer network to connect simultaneously;
When application layer is known the variation of network connection, upgrade the network connection identifier, unavailable to inform user's current network.
4, the network connection service module is held the change notification that network connects to PC.
5, PC holds the RNDIS network interface card that resets, and removes the shared relationship of local network and RNDIS network interface card.
The beneficial effect of present embodiment is: when the user triggers the shared online of PC, multiplexing PC shares the passage that online is set up, PC holds automatic triggering terminal to create the RNDIS network interface card, and it is shared to the shared online of RNDIS network interface card realization PC by outer net is connected, wherein do not need user's manual configuration network to connect, simple to operate, be easy to realize, for the user provides a kind of broadband access network mode.
Embodiment four
Referring to Fig. 5, a kind of terminal is provided in the present embodiment, this terminal links to each other with PC by USB, comprising: receiver module 401, acquisition module 402 and modular converter 403.
Receiver module 401 is used to receive the default call request of using network;
Acquisition module 402 is used to obtain current network connection type;
Modular converter 403, be used for when described current network connection type is the connection of personal computer PC shared network, described PC shared network is converted to default network, makes described default application know that local network is connected to described default network connection and allows calling of described default application.
In another embodiment, described acquisition module 402 comprises:
Call unit is used for obtaining current network connection type when described call request during from application layer.
In another embodiment, referring to Fig. 6, described modular converter 403 comprises:
Call unit 403a is used to call default application programming interfaces;
Revise unit 403b, be used for the sign of described PC shared network being revised as the sign of default network, to realize that described PC shared network is converted to described default network by described default application programming interfaces.
In another embodiment, described default network comprises: Wireless Fidelity WI-FI network.
In another embodiment, referring to Fig. 7, described terminal also comprises:
Network connects creation module 404, is used for enabling the network share service of USB when receiving the request of creating the PC shared network, sets up shared network local and the PC end.
In another embodiment, referring to Fig. 7, described network connects creation module 404, comprising:
Creating unit 404a, be used to create telecommunication network driving interface standard RNDIS network interface card, and will return the message of creating described RNDIS network interface card to the PC end, described PC being held the network of described PC end is shared the dynamic host configuration protocol DHCP function of giving described RNDIS network interface card and closing described RNDIS network interface card, is terminal distribution the 2nd RNDIS network information and domain name system DNS information also with the RNDIS network information that described PC end is set;
Receiving element 404b is used to receive the configuration order that described PC end issues, and described configuration order comprises: described the 2nd RNDIS network information and described DNS information;
Dispensing unit 404c is used for according to described configuration order described the 2nd RNDIS network information and DNS information being set on described terminal, to set up the shared network of local and described PC end.
In another embodiment, referring to Fig. 7, described terminal also comprises:
Network connection closed module 405 is used for when receiving the request that disconnects the PC shared network, and the network share service of removing to enable USB disconnects shared network local and the PC end.
In another embodiment, referring to Fig. 7, described network connection closed module 405 comprises:
Delete cells 405a is used to delete the RNDIS network interface card, and will return the message of deleting described RNDIS network interface card to PC end, makes reset described RNDIS network interface card and remove the shared relationship of described PC end network and described RNDIS network interface card of PC end.
The beneficial effect of present embodiment is: receive the default call request of using network; Obtain current network connection type; When described current network connection type is the connection of PC shared network, described PC shared network is converted to default network, make described should preset to use know that local network is connected to described default network and connects and allow calling of described default application, thereby solved the problem that current some application program can not normally be used in the PC shared network.
Embodiment five
Referring to Fig. 8, the system that provides a kind of network to share in the present embodiment, comprising: as embodiment four described terminal 400 and personal computer PC 500, described terminal 400 links to each other by general-purpose serial bus USB with described PC500.
Described PC is used for sending the request of creating the PC shared network to described terminal;
Described terminal is used for enabling the network share service of general-purpose serial bus USB when receiving the request of described establishment PC shared network, sets up the shared network of local and described PC end.
In another embodiment, described PC also be used for when receive that described terminal returns create the message of telecommunication network driving interface standard RNDIS network interface card the time, the network of described PC end is shared the DHCP function of giving described RNDIS network interface card and closing described RNDIS network interface card, also be described terminal distribution the one RNDIS network information and DNS information with the RNDIS network information that described PC end is set, and a described RNDIS network information and described DNS information are sent to described terminal by configuration order.
In another embodiment, described PC also is used for sending the request that disconnects the PC shared network to described terminal;
Described terminal also is used for when receiving the request that disconnects described PC shared network, and the network share service of removing to enable USB disconnects shared network local and the PC end.
In another embodiment, described PC also be used for when receive that described terminal returns delete the message of described RNDIS network interface card the time, described RNDIS network interface card and remove the shared relationship of described PC end network and described RNDIS network interface card resets.
The beneficial effect of present embodiment is: receive the default call request of using network; Obtain current network connection type; When described current network connection type is the connection of PC shared network, described PC shared network is converted to default network, make described should preset to use know that local network is connected to described default network and connects and allow calling of described default application, thereby solved the problem that current some application program can not normally be used in the PC shared network.
Need to prove: the system that terminal that the foregoing description provides and network are shared, only the division with above-mentioned each functional module is illustrated, in the practical application, can as required the above-mentioned functions distribution be finished by different functional modules, the internal structure of the equipment of being about to is divided into different functional modules, to finish all or part of function described above.
In addition, the method embodiment that system that the network that the foregoing description provides is shared and terminal and network are shared belongs to same design, and its specific implementation process sees method embodiment for details, repeats no more here.
The invention described above embodiment sequence number is not represented the quality of embodiment just to description.
The all or part of step that one of ordinary skill in the art will appreciate that realization the foregoing description can be finished by hardware, also can instruct relevant hardware to finish by program, described program can be stored in a kind of computer-readable recording medium, the above-mentioned storage medium of mentioning can be a read-only memory, disk or CD etc.
The above only is preferred embodiment of the present invention, and is in order to restriction the present invention, within the spirit and principles in the present invention not all, any modification of being done, is equal to replacement, improvement etc., all should be included within protection scope of the present invention.