WO2016119623A1 - 一种网络分享的实现方法和装置 - Google Patents

一种网络分享的实现方法和装置 Download PDF

Info

Publication number
WO2016119623A1
WO2016119623A1 PCT/CN2016/071549 CN2016071549W WO2016119623A1 WO 2016119623 A1 WO2016119623 A1 WO 2016119623A1 CN 2016071549 W CN2016071549 W CN 2016071549W WO 2016119623 A1 WO2016119623 A1 WO 2016119623A1
Authority
WO
WIPO (PCT)
Prior art keywords
data packet
socket
network card
wireless network
module
Prior art date
Application number
PCT/CN2016/071549
Other languages
English (en)
French (fr)
Inventor
王强
Original Assignee
阿里巴巴集团控股有限公司
王强
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 阿里巴巴集团控股有限公司, 王强 filed Critical 阿里巴巴集团控股有限公司
Priority to JP2017540199A priority Critical patent/JP6665190B2/ja
Publication of WO2016119623A1 publication Critical patent/WO2016119623A1/zh
Priority to US15/645,902 priority patent/US10499311B2/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W40/00Communication routing or communication path finding
    • H04W40/24Connectivity information management, e.g. connectivity discovery or connectivity update
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/61Installation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/46Interconnection of networks
    • H04L12/4633Interconnection of networks using encapsulation techniques, e.g. tunneling
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/66Layer 2 routing, e.g. in Ethernet based MAN's
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • H04L61/2503Translation of Internet protocol [IP] addresses
    • H04L61/2514Translation of Internet protocol [IP] addresses between local and global IP addresses
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • H04L61/2503Translation of Internet protocol [IP] addresses
    • H04L61/2517Translation of Internet protocol [IP] addresses using port numbers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • H04L61/2503Translation of Internet protocol [IP] addresses
    • H04L61/2521Translation architectures other than single NAT servers
    • H04L61/2525Translation at a client
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • H04L61/2503Translation of Internet protocol [IP] addresses
    • H04L61/2521Translation architectures other than single NAT servers
    • H04L61/2528Translation at a proxy
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • H04L61/2503Translation of Internet protocol [IP] addresses
    • H04L61/256NAT traversal
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5007Internet protocol [IP] addresses
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/40Support for services or applications
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/08Protocols for interworking; Protocol conversion
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W84/00Network topologies
    • H04W84/02Hierarchically pre-organised networks, e.g. paging networks, cellular networks, WLAN [Wireless Local Area Network] or WLL [Wireless Local Loop]
    • H04W84/10Small scale networks; Flat hierarchical networks
    • H04W84/12WLAN [Wireless Local Area Networks]

Definitions

  • the present invention relates to the field of network communication technologies, and in particular, to a method and an apparatus for implementing network sharing.
  • PC hotspot technology which is a network sharing technology with smart mobile devices.
  • the so-called PC hotspot technology is to connect the PC connected to the network as a hotspot and share the wifi signal to the smart mobile device.
  • smart mobile devices such as mobile phones, tablets or other notebooks can connect to the network through the PC to achieve simultaneous Internet access, as shown in FIG.
  • NAT Network Address Translation
  • the first is to use the Windows system's own component ICS (Internet Connection Sharing), but because the ICS component is not a core component of the Windows system, and has more dependencies on other services of the system, there is a high failure rate and stability in the actual use process. Poor sex, difficulty in positioning problems, etc.
  • ICS Internet Connection Sharing
  • NDIS Network Driver Interface Specification
  • the present invention provides a method and apparatus for network sharing, so as to implement the function of the PC hotspot and get rid of the limitation of the operating system framework.
  • the present invention provides a method for implementing network sharing, where a wireless network card is connected to a PC, and the method includes:
  • the driving module of the wireless network card converts the data packet of the wireless protocol received by the wireless network card into a data packet of the Ethernet protocol, and the NAT module determines the socket associated with the source address and the destination address of the data packet. Socket, the valid data of the data packet is sent through the Socket; and/or,
  • the NAT module After receiving the data through the Socket, the NAT module encapsulates the data into an Ethernet protocol data packet, where the destination address of the data packet is a source address associated with the Socket, and the source address of the data packet is The destination address associated with the Socket; the driver module converts the data packet into a data packet of the wireless protocol and sends the data packet through the wireless network card.
  • the drive module declares itself to be a non-NIC driver during the installation process.
  • the method further includes:
  • the driving module converts a connection request of a wireless protocol received by the wireless network card into a connection request of an Ethernet protocol
  • the NAT module creates a Socket associated with the source address and the destination address of the connection request, and the created Socket is used by the PC to establish a network connection with a device corresponding to the destination address of the connection request;
  • the NAT module encapsulates the connection response received by the Socket into a connection response of the Ethernet protocol, where the destination address of the connection response is a source address associated with the Socket, and the source address of the connection response is associated with the Socket.
  • the destination address; the driver module converts the connection response into a connection response of the wireless protocol and sends it through the wireless network card.
  • the valid data of the data packet is sent through the Socket.
  • the Socket include:
  • the method further includes: the wireless network card pre-establishing a wireless network connection with the smart mobile terminal;
  • the data packet of the wireless protocol received by the wireless network card is from the smart mobile terminal
  • the data packet of the wireless protocol sent by the wireless network card is sent to the smart mobile terminal.
  • the NAT module is placed in the driver module or placed in an upper layer application.
  • the present invention also provides an apparatus for implementing network sharing, the apparatus comprising: a driving module of a wireless network card and a NAT module;
  • the driving module is configured to convert the data packet of the wireless protocol received by the wireless network card into a data packet of the Ethernet protocol, and provide the converted data packet to the NAT module;
  • the NAT module is configured to determine a Socket associated with a source address and a destination address of the data packet provided by the driving module, and send valid data of the data packet through the Socket; and/or,
  • the NAT module is configured to: after receiving the data by using the Socket, the data is encapsulated into a data packet of the Ethernet protocol, and the encapsulated data packet is provided to the driving module, where the destination address of the data packet is a source address associated with the Socket, the source address of the data packet being a destination address associated with the Socket;
  • the driving module is configured to convert the data packet provided by the NAT module into a data packet of a wireless protocol and send the data packet through the wireless network card.
  • the driving module declares that the driving module is a non-network card driver during the installation process when the wireless network card is connected to the PC.
  • the driving module is further configured to convert a connection request of a wireless protocol received by the wireless network card into a connection request of an Ethernet protocol, and the converted connection is requested.
  • the driving module Providing to the NAT module; converting the connection response provided by the NAT module into a connection response of the wireless protocol, and transmitting the response through the wireless network card;
  • the NAT module is further configured to create a Socket associated with a source address and a destination address of the connection request provided by the driver module, where the created Socket is used to establish a network between the PC and a device corresponding to the destination address of the connection request. Connecting; the connection response received by the Socket is encapsulated into a connection response of the Ethernet protocol, wherein the destination address of the connection response is a source address associated with the Socket, and the source address of the connection response is associated with the Socket An address that provides the encapsulated connection response to the driver module.
  • the driving module sends the valid data of the data packet to the network protocol driver in the PC when the valid data of the data packet is sent through the Socket, so that the network protocol driver in the PC utilizes the After the Socket information encapsulates the valid data, the encapsulated data packet is sent through the network connection.
  • the driving module is further configured to establish a wireless network connection between the wireless network card and the smart mobile terminal, and receive, by the wireless network card, a data packet of a wireless protocol from the smart mobile terminal, The data packet of the wireless protocol is sent to the smart mobile terminal by using a wireless network card.
  • the NAT module is placed in the driver module or placed in an upper layer application.
  • the present invention processes the data packet by the driver module and the NAT module of the wireless network card to implement the PC hotspot, not the operating system, and thus is no longer restricted to the operating system framework.
  • Figure 1 is a schematic diagram of a PC hotspot technology
  • FIG. 3 is a schematic diagram of a frame according to an embodiment of the present invention.
  • FIG. 4 is a structural diagram of a device according to an embodiment of the present invention.
  • FIG. 5 is a schematic diagram of an example of implementing a PC hotspot according to an embodiment of the present invention.
  • FIG. 2 is a flowchart of an implementation method according to an embodiment of the present invention. As shown in FIG. 2, the method may include the following steps:
  • the driver module of the wireless network card declares itself to be a non-network card device driver during the installation process.
  • the wireless network card needs to be connected to the PC as a hardware, thereby implementing the PC as a hot spot for network sharing.
  • the form of the wireless network card and the connection mode of the wireless network card and the PC can be various.
  • the wireless network card can be in the form of a USB device, and the wireless network card is connected to the PC in a plug-and-play manner.
  • the driver of the wireless network card needs to be installed.
  • the driver stored in the hardware storage space can be automatically recognized, read, and installed, or the user can manually operate the PC to install the wireless network card driver.
  • the driver module in the process of driving installation of the wireless network card, may declare itself as a network card driver, or may declare itself as a non-network card driver, preferably the latter mode, wherein the declaration itself is a non-network card driver, that is, It can be declared that it is any type of drive other than the NIC driver, such as graphics card driver, mouse driver, and so on.
  • the hardware that processes network data messages is declared as a network card type, and the operating system's existing protocol stack and transit service are used to process the data.
  • the wireless network card connected to the PC may be detected by the network card detection mechanism, thereby being Block use.
  • the wireless network card driver can declare itself as a non-network card device during the installation process, for example, a device driver such as a mouse, a keyboard, a camera, or a graphics card. In this way, the operating system drives the driver as a non-NIC driver, so the normal network card detection mechanism cannot detect the wireless network card, and is based on the network. The way the card restricts user network sharing behavior does not work.
  • the operating system reads the INF (device information file) provided by the driver, such as:
  • ClassGuid ⁇ 78A1C341-4539-11d3-B88D-00C04FAD5171 ⁇
  • the operating system will query the network card according to the standard of the network card, such as the speed of the network card, the MAC address of the network card, and the like. Once the network card is installed, it will be monitored by the network firewall, anti-virus software and other software in the operating system, resulting in very large work costs, and it is easy to cause any problem in the processing of any of these software, it will cause the entire link above All the software is abnormal, it will also affect the work of the network card, because this part of the data is processed serially.
  • the standard of the network card such as the speed of the network card, the MAC address of the network card, and the like.
  • the AP (hotspot) function of the driver module can be enabled by default, or it can be turned on after receiving the control command.
  • the smart terminal device can establish a wireless connection with the wireless network card within the wireless communication range of the wireless network card, that is, execute 202, and the wireless network card establishes a wireless network connection with the smart terminal device.
  • the process of establishing a wireless network connection can adopt an existing implementation manner and will not be described in detail herein.
  • the smart terminal device When the smart terminal device wants to use the PC as a hotspot, when accessing the network through the PC, it is necessary to establish a network connection with the device to be accessed in the external network (for example, a server of a certain service provider), so the smart terminal device passes the wireless network card.
  • the wireless network connection sends a connection request of the wireless protocol, and the source address of the connection request is the IP address of the smart terminal device, and the destination address is the IP address of the device to be accessed.
  • connection request of the wireless protocol is converted into a connection request of the Ethernet protocol.
  • the wireless protocol adopts 802.11, and the Ethernet protocol adopts 802.3.
  • the connection request of the 802.11 wireless protocol is converted into a connection request of the 802.3 Ethernet protocol.
  • the NAT module creates a Socket associated with the source and destination addresses of the connection request.
  • This step may be performed by a driver of the wireless network card or by an upper application, and the upper application may be an application module in the PC.
  • the operating system may create an application module (ie, a process).
  • the application module can be implemented by using, for example, a WUDFHost process.
  • the NAT module obtains the connection request from the driver module through the file read/write interface, the source address and the destination address are parsed from the connection request, and a Socket is created for the connection request, and the IP address of the socket is the IP address of the PC, and the port number. The newly assigned port number. After the Socket is created, the association between the Socket and the source address and destination address is maintained.
  • the created Socket is used for establishing a network connection between the PC and the device corresponding to the destination address of the connection request, and the network protocol driver (such as TCP/IP protocol driver) in the PC uses the created Socket to complete the network between the devices corresponding to the destination address.
  • the establishment of the connection that is, the device corresponding to the destination address of the connection request is exposed by the IP address and port number of the PC, hiding the actual requester (smart terminal device).
  • the network protocol driver in the PC will send the connection response to the stripping protocol header and then send it to the Socket.
  • the NAT module encapsulates the connection response received by the Socket into a connection response of the Ethernet protocol, where the destination address of the connection response is a source address associated with the Socket, and the source address of the connection response is associated with the Socket. address.
  • the driving module converts the connection response into a connection response of the wireless protocol and sends the connection response to the smart terminal device through the wireless network card.
  • the smart terminal device can start data transmission between the PC and the device to be accessed, that is, perform the following steps.
  • the driver module converts the data packet of the wireless protocol received by the wireless network card into a data packet of the Ethernet protocol.
  • the smart terminal device sends a data packet to the wireless network card.
  • the source IP address of the data packet is the IP address of the smart terminal device, and the destination address is the IP address of the device to be accessed.
  • This step can be performed by the driving module, and after the driving module receives the data packet through the wireless network card, the conversion from the wireless protocol to the Ethernet protocol is performed.
  • the NAT module determines a Socket associated with the source address and the destination address of the data packet, and sends valid data of the data packet through the Socket.
  • the NAT module can find the source address and destination address associated with the data packet through the association between the source address and the destination address and the Socket. Socket. Then, the protocol header of the data packet of the Ethernet protocol is stripped, and the valid data is sent through the Socket.
  • the network protocol driver in the PC encapsulates the valid data by using the information (IP address and port number) of the Socket, and then sends the encapsulated data packet through the network connection between the previously established PC and the device to be accessed.
  • the source address of the encapsulated data packet is the IP address of the PC.
  • the device to be accessed After receiving the data packet, the device to be accessed returns a response data packet to the PC, and the network protocol driver in the PC sends the valid data in the response data packet to the corresponding Socket.
  • the NAT module encapsulates the data into a data packet of an Ethernet protocol, where the destination address of the data packet is a source address associated with the Socket, and a source address of the data packet. The destination address associated with the Socket.
  • the NAT module After receiving the data through the Socket, the NAT module determines the source address and the destination address associated with the Socket, where the source address is the IP address of the intelligent terminal device, the destination address is the IP address of the device to be accessed, and the NAT module is in the Ethernet protocol.
  • the IP address to be accessed is used as the source address of the data packet
  • the IP address of the intelligent terminal device is used as the destination of the data packet. address.
  • the driver module converts the data packet of the Ethernet protocol into a data packet of the wireless protocol, and then sends the data packet through the wireless network card.
  • the driver module converts the data packet of the Ethernet protocol into a data packet of the wireless protocol through the file read/write interface, and then sends the data packet to the intelligent terminal device through the wireless network card.
  • the embodiment of the present invention is based on the framework shown in FIG. 3, the hardware of the wireless network card is used as an entity connecting the PC and an interface for sending and receiving data messages to the intelligent terminal device, and the driver is added to the operating system.
  • a small piece of code that contains information about the hardware that enables the computer to communicate with the hardware.
  • the protocol stack is the sum of the protocols of the layers in the embodiment of the present invention, and reflects the process of data packet transmission in the embodiment of the present invention.
  • the operating system is responsible for completing the connection establishment and data message transmission between the PC and the external network.
  • FIG. 4 is a structural diagram of a device according to an embodiment of the present invention.
  • the device may include a driving module 01 and a NAT module 02 of a wireless network card.
  • the wireless network card needs to be connected to the PC as a hardware.
  • the form of the wireless network card and the form of the wireless network card and the PC can be various.
  • the wireless network card is preferably in the form of a USB device, and the wireless network card adopts a plug-and-play form. Connect to a PC.
  • the driver module 01 may declare itself as a network card driver during the installation process, or may declare itself as a non-network card device, preferably the latter mode.
  • the drive module 01 can declare itself as a device driver such as a mouse, a keyboard, a camera, a graphics card, and the like. In this way, the operating system drives the driver as a non-NIC driver, so the normal network card detection mechanism cannot detect the wireless network card, and the manner in which the network card restricts the user's network sharing behavior cannot be effective.
  • the driving module 01 first establishes a wireless network connection between the wireless network card and the smart mobile terminal; receives a connection request and a data message of the wireless protocol from the smart mobile terminal through the wireless network card, and sends the data packet of the wireless protocol to the smart through the wireless network card Mobile terminal.
  • a smart terminal device When a smart terminal device wants to use a PC as a hotspot and accesses the network through a PC, it needs to establish a network connection with the device to be accessed, so the smart terminal device passes the wireless network with the wireless network card. Connect to the connection request to send the wireless protocol. At this time, the drive module 01 converts the connection request of the wireless protocol received by the wireless network card into a connection request of the Ethernet protocol, and provides the converted connection request to the NAT module 02.
  • the NAT module 02 When the NAT module 02 obtains the connection request from the driver module 01 through the file read/write interface, it creates a Socket associated with the source address and the destination address of the connection request provided by the driver module 01, and the IP address of the socket is the IP address of the PC, and the port The number is the newly assigned port number.
  • the created Socket is used for establishing a network connection between the PC and the device corresponding to the destination address of the connection request, and the network protocol driver (such as TCP/IP protocol driver) in the PC uses the created Socket to complete the network connection between the device corresponding to the destination address.
  • the establishment that is, the network connection exposes the IP address and port number of the PC to the device corresponding to the destination address of the connection request, hiding the actual requester (smart terminal device).
  • the network protocol driver in the PC will send the connection response to the stripping protocol header and then send it to the Socket.
  • the NAT module 02 encapsulates the connection response received by the Socket into a connection response of the Ethernet protocol, wherein the destination address of the connection response is a source address associated with the Socket, and the source address of the connection response is associated with the Socket.
  • the destination address is then sent to the driver module 01 after the encapsulated connection response.
  • the driving module 01 converts the connection response into a connection response of the wireless protocol and transmits the connection response to the smart terminal device through the wireless network card.
  • the device sends the data message to the device to be accessed (the device in the external network), and the driving module 01 can convert the data packet of the wireless protocol received through the wireless network card.
  • the data packet of the Ethernet protocol is sent to the NAT module 02.
  • the NAT module 02 determines the Socket associated with the source address and the destination address of the data packet provided by the driver module 01, and passes the valid data of the data packet. Socket is sent.
  • the network protocol driver in the PC encapsulates the valid data by using the information (IP address and port number) of the Socket, and then sends the encapsulated data packet through the network connection between the previously established PC and the device to be accessed.
  • the source address of the encapsulated data packet is the IP address of the PC.
  • the device to be accessed After receiving the data packet, the device to be accessed returns a response data packet to the PC, and the network in the PC.
  • the protocol driver sends the valid data in the response data packet to the corresponding Socket.
  • the NAT module 02 After receiving the data through the Socket, the NAT module 02 encapsulates the data into an Ethernet protocol data packet, and provides the encapsulated data packet to the driver module 01, where the destination address of the data packet is associated with the Socket. Source address, the source address of the data packet is the destination address associated with the Socket.
  • the driving module 01 converts the data packet provided by the NAT module 02 into a data packet of the wireless protocol, and then sends the data packet to the smart terminal device through the wireless network card.
  • the NAT module 02 can be installed in the driver module 01, that is, it belongs to the wireless network card driver, and can also be disposed in the upper layer application.
  • the wireless network card in the form of USB is first inserted into the PC.
  • the wireless network card is similar to a USB flash drive.
  • the driver in the wireless network card storage space is automatically identified and installed.
  • the driver declares itself to be a non-NIC device driver.
  • the AP function is enabled by default.
  • the smart terminal device finds the identity of the wireless network card and then establishes a wifi connection with the wireless network card.
  • the source address is 192.168.0.3, and the destination address is 10.11.12.13.
  • the driver module converts the connection request of the wireless protocol into a connection request of the Ethernet protocol.
  • the application module obtains the connection request through the file read/write interface, it creates a Socket associated with the source address 192.168.0.3 and the destination address 10.11.12.13.
  • the IP address of the Socket is the IP of the PC, and the assumption is: 192.158.0.1, the port The number is 1024.
  • the TCP/IP protocol driver in the PC uses the Socket to establish a network connection with the server whose IP address is 10.11.12.13.
  • the peer device is a PC, that is, the IP address and port number of the PC are exposed to the server.
  • the smart terminal device is hidden.
  • the terminal device sends a data packet whose source IP address is 192.168.0.3 and whose destination address is 10.11.12.13.
  • the driver module receives the data packet through the wireless network card
  • the data packet is converted from the wifi protocol to the Ethernet protocol.
  • the application module determines a Socket associated with the source address and the destination address of the data packet, and sends valid data therein through the Socket, and the TCP/IP protocol in the PC drives the Socket.
  • the valid data is encapsulated by the IP address and the port number of the Socket.
  • the source IP address of the encapsulated data packet is 192.158.0.1, the port number is 1024, and the destination IP address is 10.11.12.13.
  • the encapsulated data packet is sent to the packet. server.
  • the TCP/IP protocol driver in the PC sends the valid data to the application module through the Socket, and the application module encapsulates the data into an Ethernet protocol data packet, where the datagram
  • the source address of the text is the destination address associated with the Socket, that is, 10.11.12.13
  • the destination address is the source address associated with the Socket, that is, 192.168.0.3
  • the application module sends the encapsulated data packet to the driver module.
  • the driver module converts the data packet of the Ethernet protocol into the wifi protocol, it sends the data packet to the smart terminal through the wireless network card.
  • the network broadband type used by the PC does not limit the number of network cards, such as the broadband used by most home types is not limited to the number of terminals accessed by the same account, then the above wireless network card After connecting to the PC, you can declare yourself as a NIC device during the driver installation of the wireless network card.
  • the type of network broadband used by the PC is to limit the number of network cards.
  • the school will restrict students' online sharing. One account can only be used on one device. For example, if the PC is in use, Then the phone can't be used. And the school generally installs a client that uses strict monitoring measures. Once it finds multiple NICs on the PC, it will disable the network service.
  • the wireless network card can be declared as a non-network card device during the driver installation process, and the client does not monitor the network sharing behavior.
  • the present invention processes the data message by the driver module and the NAT module of the wireless network card to implement the PC hotspot, not the operating system, and thus is no longer restricted to the operating system framework.
  • the protocol driver of the Windows system does not think that the network card is disconnected and the network connection is disconnected during the installation process of the driver, and the network sharing behavior is performed based on the network card detection mechanism. The restrictions are invalid.
  • the direct operation hardware is driven in the present invention, that is, the interaction with the wireless network card hardware is directly executed by the driver of the wireless network card (executed by the operating system in the prior art), bypassing the operating system and working in the user state instead of the kernel state ( That is, the process executes the user code instead of the kernel code of the operating system), so that the system compatibility problem no longer exists. Even if the driver itself has a bug that causes a crash, it will not cause problems in the operating system, avoiding the blue screen of the PC, causing the user to The risk is minimized.
  • the disclosed apparatus and method may be implemented in other manners.
  • the device embodiments described above are merely illustrative.
  • the division of the unit is only a logical function division, and the actual implementation may have another division manner.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or in the form of hardware plus software functional units.
  • the above-described integrated unit implemented in the form of a software functional unit can be stored in a computer readable storage medium.
  • the above software functional unit is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor to perform the methods of the various embodiments of the present invention. Part of the steps.
  • the foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like, which can store program codes. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

本发明提供了一种网络分享的实现方法和装置,无线网卡连接至PC,所述方法包括:所述无线网卡的驱动模块将通过无线网卡接收到的无线协议的数据报文转换为以太网协议的数据报文,网络地址转换(NAT)模块确定与该数据报文的源地址和目的地址相关联的套接字(Socket),将该数据报文的有效数据通过该Socket发送;和/或,所述NAT模块通过Socket接收到数据后,将该数据封装成以太网协议的数据报文,其中该数据报文的目的地址为与该Socket相关联的源地址,数据报文的源地址为与该Socket相关联的目的地址;所述驱动模块将该数据报文转换为无线协议的数据报文后通过无线网卡发送。本发明能够实现PC热点的功能且不受限于操作系统框架。

Description

一种网络分享的实现方法和装置 【技术领域】
本发明涉及网络通信技术领域,特别涉及一种网络分享的实现方法和装置。
【背景技术】
随着智能移动设备对wifi(无线保真)需求的日益增加,利用PC进行与智能移动设备的网络分享技术即PC热点技术迅速兴起。所谓PC热点技术就是将连接网络的PC作为热点,分享wifi信号给智能移动设备。这样手机、平板或者其他笔记本等智能移动设备就能够通过该PC连接网络,实现同时上网,如图1中所示。
NAT(Network Address Translation,网络地址转换)是PC热点稳定性及兼容性的核心,在Windows平台,现有实现PC热点的NAT方案主要有两种:
一是利用Windows系统自带组件ICS(Internet Connection Sharing,网络连接共享),但由于ICS组件非Windows系统的核心组件,且对系统其他服务依赖较多,在实际使用过程中存在失败率高,稳定性差,出现问题定位困难等缺陷。
针对ICS的上述缺陷,出现了另一种方案,即开发NDIS(Network Driver Interface Specification,网络驱动接口规范)进行网络地址转换。然而,由于NDIS作为Windows系统中的中间层,受限于Windows系统框架,在进行数据包处理时,需要经由Windows系统的协议驱动,因此在NDIS驱动的安装过程中,会出现Windows系统的协议驱动认为网卡故障而断开网络连接的情况,影响用户使用。另外NDIS驱动安装成功率低,卸载困难,NDIS作为内核态驱动一旦出现BUG,会导致PC蓝屏死机。
【发明内容】
有鉴于此,本发明提供了一种网络分享的方法和装置,以便于实现PC热点的功能且摆脱操作系统框架的限制。
具体技术方案如下:
本发明提供了一种网络分享的实现方法,无线网卡连接至PC,所述方法包括:
所述无线网卡的驱动模块将通过无线网卡接收到的无线协议的数据报文转换为以太网协议的数据报文,NAT模块确定与该数据报文的源地址和目的地址相关联的套接字Socket,将该数据报文的有效数据通过该Socket发送;和/或,
所述NAT模块通过Socket接收到数据后,将该数据封装成以太网协议的数据报文,其中该数据报文的目的地址为与该Socket相关联的源地址,数据报文的源地址为与该Socket相关联的目的地址;所述驱动模块将该数据报文转换为无线协议的数据报文后通过无线网卡发送。
根据本发明一优选实施方式,在所述驱动模块在安装过程中声明自身为非网卡驱动。
根据本发明一优选实施方式,该方法还包括:
所述驱动模块将通过所述无线网卡接收到的无线协议的连接请求转换为以太网协议的连接请求;
所述NAT模块创建与所述连接请求的源地址和目的地址相关联的Socket,创建的Socket用于所述PC与所述连接请求的目的地址对应的设备建立网络连接;
所述NAT模块将通过该Socket接收到的连接响应封装成以太网协议的连接响应,其中该连接响应的目的地址为与该Socket相关联的源地址,连接响应的源地址为与该Socket相关联的目的地址;所述驱动模块将该连接响应转换为无线协议的连接响应后通过无线网卡发送。
根据本发明一优选实施方式,将该数据报文的有效数据通过该Socket发送 包括:
将该数据报文的有效数据通过该Socket发送给所述PC中的网络协议驱动,以便于所述PC中的网络协议驱动利用所述Socket的信息封装所述有效数据后,将封装得到的数据报文通过所述网络连接发送。
根据本发明一优选实施方式,该方法还包括:所述无线网卡预先与智能移动终端建立无线网络连接;
所述通过无线网卡接收到的无线协议的数据报文来自所述智能移动终端;
通过无线网卡发送的无线协议的数据报文发送给所述智能移动终端。
根据本发明一优选实施方式,所述NAT模块置于所述驱动模块中或者置于上层应用中。
本发明还提供了一种网络分享的实现装置,该装置包括:无线网卡的驱动模块和NAT模块;
所述驱动模块,用于将通过无线网卡接收到的无线协议的数据报文转换为以太网协议的数据报文,将转换后的数据报文提供给所述NAT模块;
所述NAT模块,用于确定与所述驱动模块提供的数据报文的源地址和目的地址相关联的Socket,将该数据报文的有效数据通过该Socket发送;和/或,
所述NAT模块,用于通过Socket接收到数据后,将该数据封装成以太网协议的数据报文,将封装后的数据报文提供给所述驱动模块,其中该数据报文的目的地址为与该Socket相关联的源地址,数据报文的源地址为与该Socket相关联的目的地址;
所述驱动模块,用于将所述NAT模块提供的数据报文转换为无线协议的数据报文后通过无线网卡发送。
根据本发明一优选实施方式,所述驱动模块在所述无线网卡连接PC时的安装过程中,声明该驱动模块为非网卡驱动。
根据本发明一优选实施方式,所述驱动模块,还用于将通过所述无线网卡接收到的无线协议的连接请求转换为以太网协议的连接请求,将转换后的连接请 求提供给所述NAT模块;将所述NAT模块提供的连接响应转换为无线协议的连接响应后,通过无线网卡发送;
所述NAT模块,还用于创建与所述驱动模块提供的连接请求的源地址和目的地址相关联的Socket,创建的Socket用于所述PC与所述连接请求的目的地址对应的设备建立网络连接;将通过该Socket接收到的连接响应封装成以太网协议的连接响应,其中该连接响应的目的地址为与该Socket相关联的源地址,连接响应的源地址为与该Socket相关联的目的地址,将封装后的连接响应提供给所述驱动模块。
根据本发明一优选实施方式,所述驱动模块在将数据报文的有效数据通过该Socket发送时,发送给所述PC中的网络协议驱动,以便于所述PC中的网络协议驱动利用所述Socket的信息封装所述有效数据后,将封装得到的数据报文通过所述网络连接发送。
根据本发明一优选实施方式,所述驱动模块,还用于建立所述无线网卡与智能移动终端之间的无线网络连接;通过无线网卡接收来自所述智能移动终端的无线协议的数据报文,通过无线网卡将无线协议的数据报文发送给所述智能移动终端。
根据本发明一优选实施方式,所述NAT模块置于所述驱动模块中,或者置于上层应用中。
由以上技术方案可以看出,本发明由无线网卡的驱动模块和NAT模块对数据报文进行处理实现PC热点,而非操作系统,因此不再受限制于操作系统框架。
【附图说明】
图1为PC热点技术的示意图;
图2为本发明实施例提供的一个实现方法的流程图;
图3为本发明实施例提供的框架示意图;
图4为本发明实施例提供的装置结构图;
图5为本发明实施例提供的实现PC热点的一个实例图。
【具体实施方式】
为了使本发明的目的、技术方案和优点更加清楚,下面结合附图和具体实施例对本发明进行详细描述。
图2为本发明实施例提供的一个实现方法的流程图,如图2中所示,该方法可以包括以下步骤:
在201中,无线网卡连接PC时,无线网卡的驱动模块在安装过程中声明自身为非网卡设备驱动。
本发明实施例中,无线网卡作为一个硬件需要连接PC,从而实现将PC作为一个热点来进行网络分享。这里无线网卡的形式以及无线网卡与PC的连接形式可以多种多样,例如,无线网卡可以为USB设备的形式,无线网卡采用即插即用的方式与PC连接。当无线网卡插入PC后,需要安装无线网卡的驱动,这里可以是存储于硬件存储空间的驱动自动被识别、读取和安装,也可以是用户手动操作PC进行无线网卡驱动的安装。
本发明实施中,在无线网卡的驱动安装过程中,驱动模块可以声明自身为网卡驱动,也可以声明自身为非网卡驱动,优选后一种方式,其中,申明自身为非网卡驱动,也就是说,可以申明自身为网卡驱动以外的任意一种驱动类型,例如显卡驱动、鼠标驱动等。
通常在Windows系统中,处理网络数据报文的硬件都声明为网卡类型,求助于操作系统现有的协议栈和中转服务来处理数据。一旦声明成网卡类型,如果所处的网络环境是限制共享网络的网卡数量的,例如一个账号只允许一个网卡同时使用网络,那么该连接PC的无线网卡可能会被网卡检测机制检测出,从而被阻止使用。在本发明中,用于进行网络分享的无线网卡在连接PC时,无线网卡驱动在安装过程中可以声明自身为非网卡设备,例如可以是鼠标、键盘、摄像头、显卡等设备驱动。这样,操作系统就将该驱动作为非网卡驱动,那么通常的网卡探测机制就无法探测到该无线网卡,并且基于网 卡限制用户网络共享行为的方式就无法产生效果。
驱动在安装的过程中,操作系统读取驱动提供的INF(设备信息文件),诸如:
[Version]
Signature="$Windows NT$"
Class=Sample
ClassGuid={78A1C341-4539-11d3-B88D-00C04FAD5171}
其中Class=Sample行即表明当前设备所属的类型。如果申明为网卡,则可以为Class=Net。
然而,驱动一旦申明成自身是网卡驱动,则操作系统会按照网卡的标准来询问网卡,比如网卡的速度、网卡的MAC地址等信息。一旦网卡被安装,就会被操作系统中的网络防火墙,杀毒软件等软件监视,造成工作开销非常大,并且容易造成一旦这些软件中的任何一个处理上存在问题,就会造成整条链路上面的所有软件全部异常,也会影响网卡的工作,因为这部分数据是串行处理的。
在本发明实施例中,声明驱动为非网卡驱动时,可设置的Class类型是很多的,比如蓝牙的Class=Bluetooth,摄像头的Class=Image等等。
在驱动安装完成后,该驱动模块的AP(热点)功能可以默认开启,也可以在收到控制命令后开启。AP功能开启后,在该无线网卡的无线通信范围内,智能终端设备可以与该无线网卡建立无线连接,即执行202,无线网卡与智能终端设备建立无线网络连接。建立无线网络连接的过程可以采用现有实现方式,在此不再详述。
当智能终端设备要将PC作为热点,通过PC访问网络时,需要建立与外部网络中要访问设备(例如某个服务提供商的服务器)之间的网络连接,因此智能终端设备会通过与无线网卡之间的无线网络连接发送无线协议的连接请求,该连接请求的源地址为智能终端设备的IP地址,目的地址为要访问设备的IP地址。
在203中,驱动模块通过无线网卡接收到无线协议的连接请求后,将无线协议的连接请求转换为以太网协议的连接请求。
例如,本发明实施例中无线协议采用802.11,以太网协议采用802.3,则本步骤将802.11无线协议的连接请求转换为802.3以太网协议的连接请求。
在204中,NAT模块创建与该连接请求的源地址和目的地址相关联的Socket。
本步骤可以由无线网卡的驱动执行,也可以由上层应用执行,该上层应用可以为PC中的应用模块,当诸如Windows等操作系统与无线网卡通信时,操作系统可以创建一个应用模块(即进程),并将无线网卡的驱动加载至该应用模块,该应用模块可以采用诸如WUDFHost进程实现。
NAT模块通过文件读写接口从驱动模块获取到连接请求时,从该连接请求中解析得到源地址和目的地址,针对该连接请求创建一个Socket,该Socket的IP地址为PC的IP地址,端口号为新分配的端口号。创建Socket后,维护该Socket与源地址、目标地址的关联关系。
该创建的Socket用于PC与该连接请求的目的地址对应的设备建立网络连接,PC中的网络协议驱动(诸如TCP/IP协议驱动)利用该创建的Socket完成与目的地址对应的设备之间网络连接的建立,也就是说,该网络连接对连接请求的目的地址对应的设备暴露的是PC的IP地址和端口号,隐藏了实际的请求者(智能终端设备)。
对于外部网络返回的连接响应,PC中的网络协议驱动会将该连接响应剥离协议头后发送给Socket。NAT模块将通过该Socket接收到的连接响应封装成以太网协议的连接响应,其中该连接响应的目的地址为与该Socket相关联的源地址,连接响应的源地址为与该Socket相关联的目的地址。驱动模块将该连接响应转换为无线协议的连接响应后通过无线网卡发送给智能终端设备。
一旦该网络连接建立完成后,智能终端设备可以开始经由PC与要访问的设备之间进行数据传输,即执行以下步骤。
在205中,驱动模块将通过无线网卡接收到的无线协议的数据报文转换为以太网协议的数据报文。
智能终端设备发送数据报文给无线网卡,该数据报文的源IP地址为智能终端设备的IP地址,目的地址为要访问设备的IP地址。本步骤可以由驱动模块执行,驱动模块通过无线网卡接收到该数据报文后,进行从无线协议至以太网协议的转换。
在206中,NAT模块确定与该数据报文的源地址和目的地址相关联的Socket,将该数据报文的有效数据通过该Socket发送。
NAT模块通过文件读写接口从驱动模块获取到数据报文后,通过之前维护的源地址、目的地址与Socket之间的关联关系,可以找到与该数据报文的源地址、目的地址相关联的Socket。然后将以太网协议的数据报文的协议头剥离,将其中的有效数据通过该Socket发送。
PC中的网络协议驱动利用该Socket的信息(IP地址和端口号)封装该有效数据后,将封装得到的数据报文通过之前建立的PC与要访问的设备之间的网络连接发送。封装后的数据报文的源地址为PC的IP地址。要访问的设备接收到该数据报文后,会向PC返回响应的数据报文,PC中的网络协议驱动将该响应的数据报文中的有效数据发送至对应的Socket。
在207中,NAT模块通过Socket接收到数据后,将该数据封装成以太网协议的数据报文,其中该数据报文的目的地址为与该Socket相关联的源地址,数据报文的源地址为与该Socket相关联的目的地址。
NAT模块通过Socket接收到数据后,确定与该Socket相关联的源地址和目的地址,其中源地址为智能终端设备的IP地址,目的地址为要访问设备的IP地址,NAT模块在进行以太网协议的数据报文封装时,将要访问的IP地址作为数据报文的源地址,将智能终端设备的IP地址作为数据报文的目的 地址。
在208中,驱动模块将以太网协议的数据报文转换为无线协议的数据报文后,通过无线网卡发送。
驱动模块通过文件读写接口将以太网协议的数据报文转换为无线协议的数据报文后,通过无线网卡发送给智能终端设备。
由上述流程可以看出,本发明实施例基于如图3中所示的框架,无线网卡的硬件作为连接PC的实体以及面向智能终端设备收发数据报文的接口,驱动作为添加到操作系统中的一小块代码,包含有关硬件的信息,使得计算机能够与该硬件进行通信。协议栈是本发明实施例中各层协议的总和,反映了本发明实施例中数据报文传输的过程。操作系统负责完成PC与外部网络之间的连接建立和数据报文传输。
以上是对本发明所提供的方法进行的详细描述,下面对本发明提供的装置进行详细描述。图4为本发明实施例提供的装置结构图,如图4中所示,该装置可以包括无线网卡的驱动模块01和NAT模块02。其中无线网卡作为一个硬件需要连接PC,无线网卡的形式以及无线网卡与PC的形式可以多种多样,在本发明实施例中优选无线网卡为USB设备的形式,无线网卡采用即插即用的形式与PC连接。当无线网卡连接PC时,驱动模块01在安装过程中可以声明自身为网卡驱动,也可以声明自身为非网卡设备,优选后一种方式。驱动模块01可以声明自身为诸如鼠标、键盘、摄像头、显卡等设备驱动。这样,操作系统就将该驱动作为非网卡驱动,那么通常的网卡探测机制就无法探测到该无线网卡,并且基于网卡限制用户网络共享行为的方式就无法产生效果。
驱动模块01首先建立无线网卡与智能移动终端之间的无线网络连接;通过无线网卡接收来自智能移动终端的无线协议的连接请求和数据报文,通过无线网卡将无线协议的数据报文发送给智能移动终端。
当智能终端设备要将PC作为热点,通过PC访问网络时,需要建立与要访问设备之间的网络连接,因此智能终端设备会通过与无线网卡之间的无线网络 连接发送无线协议的连接请求。此时驱动模块01将通过无线网卡接收到的无线协议的连接请求转换为以太网协议的连接请求,将转换后的连接请求提供给NAT模块02。
NAT模块02通过文件读写接口从驱动模块01获取到连接请求时,创建与驱动模块01提供的连接请求的源地址和目的地址相关联的Socket,该Socket的IP地址为PC的IP地址,端口号为新分配的端口号。该创建的Socket用于PC与连接请求的目的地址对应的设备建立网络连接,PC中的网络协议驱动(诸如TCP/IP协议驱动)利用该创建的Socket完成与目的地址对应的设备之间网络连接的建立,也就是说,该网络连接对连接请求的目的地址对应的设备暴露的是PC的IP地址和端口号,隐藏了实际的请求者(智能终端设备)。
对于外部网络返回的连接响应,PC中的网络协议驱动会将该连接响应剥离协议头后发送给Socket。NAT模块02将通过该Socket接收到的连接响应封装成以太网协议的连接响应,其中该连接响应的目的地址为与该Socket相关联的源地址,连接响应的源地址为与该Socket相关联的目的地址,然后将封装后的连接响应发送给驱动模块01。驱动模块01将该连接响应转换为无线协议的连接响应后通过无线网卡发送给智能终端设备。
该装置在实现PC热点的主要过程中,对于智能终端设备发送数据报文至要访问的设备(外部网络中的设备),驱动模块01可以将通过无线网卡接收到的无线协议的数据报文转换为以太网协议的数据报文,将转换后的数据报文提供给NAT模块02。NAT模块02通过文件读写接口从驱动模块01获取到数据报文后,确定与驱动模块01提供的数据报文的源地址和目的地址相关联的Socket,将该数据报文的有效数据通过该Socket发送。
然后PC中的网络协议驱动利用该Socket的信息(IP地址和端口号)封装该有效数据后,将封装得到的数据报文通过之前建立的PC与要访问的设备之间的网络连接发送。封装后的数据报文的源地址为PC的IP地址。要访问的设备接收到该数据报文后,会向PC返回响应的数据报文,PC中的网络 协议驱动将该响应的数据报文中的有效数据发送至对应的Socket。
NAT模块02通过Socket接收到数据后,将该数据封装成以太网协议的数据报文,将封装后的数据报文提供给驱动模块01,其中该数据报文的目的地址为与该Socket相关联的源地址,数据报文的源地址为与该Socket相关联的目的地址。驱动模块01将NAT模块02提供的数据报文转换为无线协议的数据报文后通过无线网卡发送给智能终端设备。
上述NAT模块02可以设置于驱动模块01中,即都属于无线网卡驱动,也可以设置于上层应用中。
下面举一个例子,假设当IP地址为192.168.0.3的智能终端设备通过PC热点要访问外网中IP地址为10.11.12.13的服务器时,如图5所示,首先将USB形式的无线网卡插入PC,该无线网卡类似一个U盘,插入PC后,无线网卡存储空间中的驱动被自动识别和安装,在安装过程中驱动声明自身为非网卡设备驱动。驱动完成后,默认开启AP功能。智能终端设备找到该无线网卡的标识,然后与该无线网卡建立wifi连接。
智能终端设备要访问服务器时,发送源地址为192.168.0.3,目的地址为10.11.12.13的连接请求。驱动模块通过无线网卡接收到该连接请求后,将无线协议的连接请求转换为以太网协议的连接请求。应用模块通过文件读写接口获取到该连接请求后,创建与源地址192.168.0.3、目的地址10.11.12.13相关联的Socket,该Socket的IP地址为PC的IP,假设为:192.158.0.1,端口号为1024。然后PC中的TCP/IP协议驱动利用该Socket与IP地址为10.11.12.13的服务器建立网络连接,对于服务器而言,对端设备为PC,即对服务器暴露的是PC的IP地址和端口号,而隐藏了智能终端设备。
终端设备发送源IP地址为192.168.0.3,目的地址为10.11.12.13的数据报文,驱动模块通过无线网卡收到该数据报文后,将该数据报文从wifi协议转换为以太网协议。应用模块确定与该数据报文的源地址和目的地址相关联的Socket,将其中的有效数据通过Socket发送,PC中的TCP/IP协议驱动利 用Socket的IP地址和端口号封装该有效数据,封装得到的数据报文的源IP地址为192.158.0.1,端口号为1024,目的IP地址为10.11.12.13,将封装得到的数据报文发送给服务器。
对于服务器返回的响应数据报文,则PC中的TCP/IP协议驱动会将其中的有效数据通过Socket发送给应用模块,应用模块将该数据封装成以太网协议的数据报文,其中该数据报文的源地址为Socket相关联的目的地址,即10.11.12.13,目的地址为Socket相关联的源地址,即192.168.0.3,然后应用模块将封装后的数据报文发送给驱动模块。驱动模块将以太网协议的数据报文转换为wifi协议后,通过无线网卡发送给智能终端。
另外,在本发明实施例中,如果PC所使用的网络宽带类型是不限制网卡数量的,诸如大多数家庭类型所使用的宽带是不限制同一账号接入的终端数量的,那么上述的无线网卡连接PC后,在无线网卡的驱动安装过程中就可以声明自身为网卡设备。
但也有些情况,PC所使用的网络宽带类型是限制网卡数量的,例如有些校园网环境,学校会限制学生的上网共享,一个账号只能在一台设备上使用,例如,如果PC在用,那么手机就不能使用了。并且学校一般安装了使用严密监控措施的客户端,一旦发现PC上有多块网卡,就会禁用网络服务。对于这种情况,本发明实施例中上述的无线网卡连接PC后,在无线网卡的驱动安装过程中就可以声明自身为非网卡设备,那么上述客户端就监控不到该网络共享行为。
由以上描述可以看出,本发明提供的方法和装置具备以下优点:
1)本发明由无线网卡的驱动模块和NAT模块对数据报文进行处理实现PC热点,而非操作系统,因此不再受限制于操作系统框架。
2)另外,由于驱动可以不声明硬件为网卡,因此不会在驱动的安装过程中出现Windows系统的协议驱动认为网卡故障而断开网络连接的情况,且基于网卡探测机制对网络分享行为进行的限制都是无效的。
3)本发明中驱动直接操作硬件,即与无线网卡硬件的交互由无线网卡的驱动直接执行(现有技术中是由操作系统执行),绕过操作系统并且工作在用户态而非内核态(即进程执行的是用户代码而非操作系统的内核代码),使得系统兼容性问题不再存在,即使驱动程序本身存在BUG导致崩溃,也不会导致操作系统出现问题,避免PC蓝屏死机,使得用户的风险最小化。
在本发明所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能单元的形式实现。
上述以软件功能单元的形式实现的集成的单元,可以存储在一个计算机可读取存储介质中。上述软件功能单元存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或处理器(processor)执行本发明各个实施例所述方法的部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述仅为本发明的较佳实施例而已,并不用以限制本发明,凡在本发明的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在 本发明保护的范围之内。

Claims (12)

  1. 一种网络分享的实现方法,其特征在于,无线网卡连接至PC,所述方法包括:
    所述无线网卡的驱动模块将通过无线网卡接收到的无线协议的数据报文转换为以太网协议的数据报文,网络地址转换NAT模块确定与该数据报文的源地址和目的地址相关联的套接字Socket,将该数据报文的有效数据通过该Socket发送;和/或,
    所述NAT模块通过Socket接收到数据后,将该数据封装成以太网协议的数据报文,其中该数据报文的目的地址为与该Socket相关联的源地址,数据报文的源地址为与该Socket相关联的目的地址;所述驱动模块将该数据报文转换为无线协议的数据报文后通过无线网卡发送。
  2. 根据权利要求1所述的方法,其特征在于,所述驱动模块在安装过程中声明自身为非网卡驱动。
  3. 根据权利要求1所述的方法,其特征在于,该方法还包括:
    所述驱动模块将通过所述无线网卡接收到的无线协议的连接请求转换为以太网协议的连接请求;
    所述NAT模块创建与所述连接请求的源地址和目的地址相关联的Socket,创建的Socket用于所述PC与所述连接请求的目的地址对应的设备建立网络连接;
    所述NAT模块将通过该Socket接收到的连接响应封装成以太网协议的连接响应,其中该连接响应的目的地址为与该Socket相关联的源地址,连接响应的源地址为与该Socket相关联的目的地址;所述驱动模块将该连接响应转换为无线协议的连接响应后通过无线网卡发送。
  4. 根据权利要求3所述的方法,其特征在于,将该数据报文的有效数据通过该Socket发送包括:
    将该数据报文的有效数据通过该Socket发送给所述PC中的网络协议驱动, 以便于所述PC中的网络协议驱动利用所述Socket的信息封装所述有效数据后,将封装得到的数据报文通过所述网络连接发送。
  5. 根据权利要求1所述的方法,其特征在于,该方法还包括:所述无线网卡预先与智能移动终端建立无线网络连接;
    所述通过无线网卡接收到的无线协议的数据报文来自所述智能移动终端;
    通过无线网卡发送的无线协议的数据报文发送给所述智能移动终端。
  6. 根据权利要求1至5任一权项所述的方法,其特征在于,所述NAT模块置于所述驱动模块中或者置于上层应用中。
  7. 一种网络分享的实现装置,其特征在于,该装置包括:无线网卡的驱动模块和NAT模块,
    所述驱动模块,用于将通过无线网卡接收到的无线协议的数据报文转换为以太网协议的数据报文,将转换后的数据报文提供给所述NAT模块;
    所述NAT模块,用于确定与所述驱动模块提供的数据报文的源地址和目的地址相关联的Socket,将该数据报文的有效数据通过该Socket发送;和/或,
    所述NAT模块,用于通过Socket接收到数据后,将该数据封装成以太网协议的数据报文,将封装后的数据报文提供给所述驱动模块,其中该数据报文的目的地址为与该Socket相关联的源地址,数据报文的源地址为与该Socket相关联的目的地址;
    所述驱动模块,用于将所述NAT模块提供的数据报文转换为无线协议的数据报文后通过无线网卡发送。
  8. 根据权利要求7所述的装置,其特征在于,所述驱动模块在所述无线网卡连接PC时的安装过程中,声明该驱动模块为非网卡驱动。
  9. 根据权利要求7所述的装置,其特征在于,所述驱动模块,还用于将通过所述无线网卡接收到的无线协议的连接请求转换为以太网协议的连接请求,将转换后的连接请求提供给所述NAT模块;将所述NAT模块提供的连接响应转换为无线协议的连接响应后,通过无线网卡发送;
    所述NAT模块,还用于创建与所述驱动模块提供的连接请求的源地址和目的地址相关联的Socket,创建的Socket用于所述PC与所述连接请求的目的地址对应的设备建立网络连接;将通过该Socket接收到的连接响应封装成以太网协议的连接响应,其中该连接响应的目的地址为与该Socket相关联的源地址,连接响应的源地址为与该Socket相关联的目的地址,将封装后的连接响应提供给所述驱动模块。
  10. 根据权利要求7所述的装置,其特征在于,所述NAT模块在将数据报文的有效数据通过该Socket发送时,发送给所述PC中的网络协议驱动,以便于所述PC中的网络协议驱动利用所述Socket的信息封装所述有效数据后,将封装得到的数据报文通过所述网络连接发送。
  11. 根据权利要求7所述的装置,其特征在于,所述驱动模块,还用于建立所述无线网卡与智能移动终端之间的无线网络连接;通过无线网卡接收来自所述智能移动终端的无线协议的数据报文,通过无线网卡将无线协议的数据报文发送给所述智能移动终端。
  12. 根据权利要求7至11任一权项所述的装置,其特征在于,所述NAT模块置于所述驱动模块中,或者置于上层应用中。
PCT/CN2016/071549 2015-01-30 2016-01-21 一种网络分享的实现方法和装置 WO2016119623A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
JP2017540199A JP6665190B2 (ja) 2015-01-30 2016-01-21 ネットワーク共有実施方法及び装置
US15/645,902 US10499311B2 (en) 2015-01-30 2017-07-10 Method and apparatus for implementing network sharing

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510050899.2A CN105991679B (zh) 2015-01-30 2015-01-30 一种网络分享的实现方法和装置
CN201510050899.2 2015-01-30

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US15/645,902 Continuation US10499311B2 (en) 2015-01-30 2017-07-10 Method and apparatus for implementing network sharing

Publications (1)

Publication Number Publication Date
WO2016119623A1 true WO2016119623A1 (zh) 2016-08-04

Family

ID=56542399

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/071549 WO2016119623A1 (zh) 2015-01-30 2016-01-21 一种网络分享的实现方法和装置

Country Status (4)

Country Link
US (1) US10499311B2 (zh)
JP (1) JP6665190B2 (zh)
CN (1) CN105991679B (zh)
WO (1) WO2016119623A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114499924A (zh) * 2021-12-02 2022-05-13 厦门市美亚柏科信息股份有限公司 基于网络接口控制器的数据防泄漏方法及存储介质

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE102015016616A1 (de) * 2015-12-22 2017-06-22 Giesecke & Devrient Gmbh Vorrichtung und Verfahren zur Verbindung einer Produktionsvorrichtung mit einem Netzwerk
US11838375B2 (en) * 2020-11-12 2023-12-05 Harman International Industries, Incorporated Universal software communication bus
CN112968791B (zh) * 2021-01-20 2022-08-05 福建新大陆通信科技股份有限公司 一种CTID智能门禁外接usb网卡通信方法及系统
CN115695056A (zh) * 2022-10-14 2023-02-03 中电云数智科技有限公司 一种用于智能网卡运维的系统

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN201039395Y (zh) * 2007-05-22 2008-03-19 北京东方讯科技发展有限公司 一种无线网络路由器
CN101562864A (zh) * 2009-05-12 2009-10-21 深圳华为通信技术有限公司 热点装置
CN202841409U (zh) * 2012-08-31 2013-03-27 博视联(苏州)信息科技有限公司 一种带wifi热点的机顶盒装置

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040196486A1 (en) * 2003-04-01 2004-10-07 Atsushi Uchino Addressbook service for network printer
KR100630355B1 (ko) * 2004-08-04 2006-09-29 한국전자통신연구원 무선 랜에서의 프레임 브리지 제공 장치 및 그 방법
US20080113674A1 (en) * 2006-11-10 2008-05-15 Mohammad Faisal Baig Vicinity-based community for wireless users
CN101511132B (zh) * 2009-03-23 2011-01-05 杭州华三通信技术有限公司 一种数据报文的转发方法和系统
JP2011004271A (ja) * 2009-06-19 2011-01-06 Nec Corp 無線lan搭載データカード、通信方法及びプログラム
JP5468595B2 (ja) * 2011-11-22 2014-04-09 レノボ・シンガポール・プライベート・リミテッド 共有通信による無線ネットワークへのアクセス方法および無線端末装置
CN102880508A (zh) * 2012-09-14 2013-01-16 深圳市中兴移动通信有限公司 一种实现PC操控Android终端的方法及系统

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN201039395Y (zh) * 2007-05-22 2008-03-19 北京东方讯科技发展有限公司 一种无线网络路由器
CN101562864A (zh) * 2009-05-12 2009-10-21 深圳华为通信技术有限公司 热点装置
CN202841409U (zh) * 2012-08-31 2013-03-27 博视联(苏州)信息科技有限公司 一种带wifi热点的机顶盒装置

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114499924A (zh) * 2021-12-02 2022-05-13 厦门市美亚柏科信息股份有限公司 基于网络接口控制器的数据防泄漏方法及存储介质

Also Published As

Publication number Publication date
JP6665190B2 (ja) 2020-03-13
JP2018510538A (ja) 2018-04-12
US10499311B2 (en) 2019-12-03
US20170311224A1 (en) 2017-10-26
CN105991679B (zh) 2019-07-09
CN105991679A (zh) 2016-10-05

Similar Documents

Publication Publication Date Title
WO2016119623A1 (zh) 一种网络分享的实现方法和装置
US10721309B2 (en) System and method for supporting data communication in a heterogeneous environment
WO2023284699A1 (zh) 基于Linux系统的协议栈数据传输方法、计算机设备和存储介质
US8700820B2 (en) Method for accessing USB device attached to home gateway, home gateway and terminal
JP2014520327A (ja) モバイル・コンピューティング・デバイスを介して管理されたusbサービスをリモートに送達する方法および装置
US10594768B2 (en) Method and apparatus of performing remote command dispatching
CN111385238B (zh) 一种数据传输方法及装置
WO2020038443A1 (zh) 桥接通信的方法和设备
JP6195465B2 (ja) 同期サーバ側スクリプティングを用いた遠隔カードコンテンツ管理
US20070199065A1 (en) Information processing system
US20070155422A1 (en) Method for controlling mobile data connection through USB Ethernet management of mobile station
KR101890592B1 (ko) 네트워크에서 성능 정보를 관리하는 방법 및 장치
US9078282B2 (en) Method and apparatus for implementing network device function of wireless communication terminal
JP6539497B2 (ja) 通信中継システム、デバイス収容端末、サーバ側コンピュータ、プログラム、及び通信中継方法
JP6281369B2 (ja) 通信システム及び通信プログラム
JP5848741B2 (ja) ホストと無線インターネットアクセスモジュールとの間の通信方法、及びホスト通信モジュール
JP2014140106A (ja) 中継装置、その制御方法、及びその制御プログラム
CN115756724A (zh) 虚拟化服务的运行方法和装置、存储介质、电子设备
CN116389555A (zh) 为局域网内的终端提供服务的方法、装置、设备及介质
CN114090487A (zh) 安卓模拟器与诊断设备的通讯方法、装置、系统、存储介质及电子设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16742685

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2017540199

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16742685

Country of ref document: EP

Kind code of ref document: A1