CN113543147A - Ethernet sharing method based on Android system - Google Patents

Ethernet sharing method based on Android system Download PDF

Info

Publication number
CN113543147A
CN113543147A CN202110810286.XA CN202110810286A CN113543147A CN 113543147 A CN113543147 A CN 113543147A CN 202110810286 A CN202110810286 A CN 202110810286A CN 113543147 A CN113543147 A CN 113543147A
Authority
CN
China
Prior art keywords
ethernet
network
sharing
ready
interface
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
Application number
CN202110810286.XA
Other languages
Chinese (zh)
Other versions
CN113543147B (en
Inventor
王安兴
程玉
胡锐生
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Maichong Technology Co ltd
Original Assignee
Hangzhou Maichong Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Maichong Technology Co ltd filed Critical Hangzhou Maichong Technology Co ltd
Priority to CN202110810286.XA priority Critical patent/CN113543147B/en
Publication of CN113543147A publication Critical patent/CN113543147A/en
Application granted granted Critical
Publication of CN113543147B publication Critical patent/CN113543147B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W16/00Network planning, e.g. coverage or traffic planning tools; Network deployment, e.g. resource partitioning or cells structures
    • H04W16/14Spectrum sharing arrangements between different networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/45Network directories; Name-to-address mapping
    • H04L61/4505Network directories; Name-to-address mapping using standardised directories; using standardised directory access protocols
    • H04L61/4511Network directories; Name-to-address mapping using standardised directories; using standardised directory access protocols using domain name system [DNS]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W16/00Network planning, e.g. coverage or traffic planning tools; Network deployment, e.g. resource partitioning or cells structures
    • H04W16/18Network planning tools

Abstract

The invention discloses an Ethernet sharing method based on an Android system, which comprises the following steps: s1, turning on the Ethernet sharing switch, including adding an Ethernet sharing switch button in the setting interface to provide a code interface, or integrating the switch function into APK source code, setting the interface function for turning on the Ethernet sharing, and designating a turn-on parameter to complete the turn-on function; s2, judging whether the Ethernet is ready, if the Ethernet is ready, continuing the next step, otherwise returning an error message to prompt the sharing failure; s3, judging whether the specified source network is ready or not, and judging whether the specified network is successfully connected or not by calling a method for checking whether the network is connected or not in the Android self-contained network management tool class by the system; s4, configuring information including the network segment of the subnet and the DNS; s5, starting DHCP service and network forwarding, and entering into network sharing state.

Description

Ethernet sharing method based on Android system
Technical Field
The invention belongs to the technical field of Android system application, and particularly relates to an Ethernet sharing method based on an Android system.
Background
Many android industrial control devices on the market contain ethernet ports, and after a large number of users purchase the industrial control devices, other devices need to use the ethernet ports to realize the requirement of external network access, such as a network camera. In order to facilitate users and reduce unnecessary wired networking and additional expenses, a 4G routing device that can be used in an open environment is urgently needed.
In the Android native system, a function called a portable WLAN hotspot is provided, and the function can configure the Android mobile phone into an AP hotspot and is similar to a function of a simplified version 4G router. After the network is started, the 4G at the moment is called as a source network, and the WIFI is called as a shared network. However, it has the following disadvantages: (1) an Ethernet port cannot be configured to realize Ethernet sharing for a sharing network; (2) no source network can be specified (only the system's own default source network can be used); (3) the network segment and DNS of the subnet cannot be configured; (4) the connection state and information of all the sub-network devices connected to the shared network cannot be monitored and checked; (5) no API interface is provided to control the turning on and off of the network sharing function.
Disclosure of Invention
In view of the above technical problems, the present invention is directed to providing an ethernet sharing method based on an Android system.
In order to solve the technical problems, the invention adopts the following technical scheme:
an Ethernet sharing method based on an Android system comprises the following steps:
s1, turning on the Ethernet sharing switch, including adding an Ethernet sharing switch button in the setting interface to provide a code interface, or integrating the switch function into APK source code, setting the interface function for turning on the Ethernet sharing, and designating a turn-on parameter to complete the turn-on function;
s2, judging whether the Ethernet is ready, if the Ethernet is ready, continuing the next step, otherwise returning an error message to prompt the sharing failure;
s3, judging a designated source network and judging whether the source network is ready, judging whether the designated network is successfully connected or not by calling a method of checking whether the network is connected or not in an Android self-contained network management tool class by the system, if the network is connected and the source network is ready, taking the network as the source network shared by the Ethernet, and if the network is not connected and the source network is not ready, returning a corresponding error code;
s4, configuring information including the network segment of the subnet and the DNS;
s5, starting DHCP service and network forwarding, and entering into network sharing state.
Preferably, S2 specifically includes: firstly, finding out a network node of the Ethernet, monitoring the connection state change information of a bottom Ethernet port through the node, if the Linkup information of the port appears, successfully connecting an Ethernet link layer, indicating that the Ethernet is ready, and using the Ethernet as a shared network; if the information of the Link down appears, the Ethernet Link layer is disconnected, the Ethernet can not be used as a sharing network at the moment, the Ethernet sharing fails, and if the sharing is opened before, the Ethernet sharing function is closed at the moment.
Preferably, S4 specifically includes: in the specific code for starting the network sharing function, the original fixed IP address and the function of a DNS are deleted, in the method for configuring the Ethernet interface configureEthface, the appointed IP address and DNS variable information are read from a memory each time, an appointed IP address pool is allocated after the shared service is started, the IP address pool is configured in the DHCP service, the IP address obtained by the network equipment is in the configured network segment, or the appointed DNS address is configured in the DNS service of a system, and an interface of a network management module is called to set an appointed DNS server.
Preferably, the method further comprises monitoring the connection state and information of all the subnet devices, if the user needs to monitor the connection state of the subnet devices, the user needs to register a network listener first, call the network monitoring module to register a listener, periodically send a network packet to all the subnet devices, judge the connection state by checking the network packet condition replied by all the subnet devices, if the reply can be received, the subnet devices are in the connection state, otherwise, the subnet devices are disconnected; if the result of the check is different from the last time, a state change notification is sent to the monitor and is accompanied with specific state change information, and if monitoring needs to be stopped, a network monitoring module is called.
Preferably, the method further comprises providing an API interface for the client to switch the ethernet share and adjust the configuration of the ethernet share in the program.
The invention has the following beneficial effects:
(1) ethernet may be configured to enable ethernet sharing;
(2) the network source may be designated as the source network for the ethernet share;
(3) the network segment IP address and DNS information of the shared sub-network can be freely configured;
(4) the connection state and information of all the sub-network devices connected to the shared network can be monitored and checked;
(5) an API interface is provided to allow the client to switch on and off the ethernet share and adjust the configuration of the ethernet share in the program.
Drawings
Fig. 1 is a flowchart illustrating steps of an ethernet sharing method based on an Android system according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, shown is a flowchart illustrating steps of an ethernet sharing method based on an Android system according to an embodiment of the present invention, including the following steps:
s1, turning on the Ethernet sharing switch, including adding an Ethernet sharing switch button in the setting interface to provide a code interface, or integrating the switch function into APK source code, setting the interface function for turning on the Ethernet sharing, and designating a turn-on parameter to complete the turn-on function;
s2, judging whether the Ethernet is ready, if the Ethernet is ready, continuing the next step, otherwise returning an error message to prompt the sharing failure;
s3, judging a designated source network and judging whether the source network is ready, judging whether the designated network is successfully connected or not by calling a method of checking whether the network is connected or not in an Android self-contained network management tool class by the system, if the network is connected and the source network is ready, taking the network as the source network shared by the Ethernet, and if the network is not connected and the source network is not ready, returning a corresponding error code;
s4, configuring information including the network segment of the subnet and the DNS;
s5, starting DHCP service and network forwarding, and entering into network sharing state.
In a specific application example, S2 specifically includes: firstly, finding out a network node of the Ethernet, monitoring the connection state change information of a bottom Ethernet port through the node, if the Link up information of the port appears, successfully connecting an Ethernet Link layer, indicating that the Ethernet is ready, and using the Ethernet as a shared network; if the information of the Link down appears, the Ethernet Link layer is disconnected, the Ethernet can not be used as a sharing network at the moment, the Ethernet sharing fails, and if the sharing is opened before, the Ethernet sharing function is closed at the moment.
In a specific application example, S4 specifically includes: in the method for configuring the Ethernet interface, appointed IP address and DNS variable information are read from a memory each time, an appointed IP address pool is allocated after the shared service is started, the IP address pool is configured in the DHCP service, the IP address obtained by the network equipment is in a configured network segment, or the appointed DNS address is configured in the DNS service of a system, and an interface of the network management service is called to set an appointed DNS server.
In the specific application example, the method further comprises monitoring the connection state and information of all the subnet equipment, if the user needs to monitor the connection state of the subnet equipment, the user needs to register a network monitor first, call a network monitoring module to register a monitor, periodically send a network packet to all the subnet equipment, judge the connection state by checking the network packet condition replied by all the subnet equipment, if the reply can be received, the subnet equipment is in the connection state, otherwise, the subnet equipment is disconnected; if the result of the check is different from the last time, a state change notification is sent to the monitor and is accompanied with specific state change information, and if monitoring needs to be stopped, a network monitoring module is called.
In a specific application example, the method further comprises the step of providing an API (application programming interface) to enable a client to switch on and off the Ethernet sharing in a program and adjust the configuration condition of the Ethernet sharing.
It is to be understood that the exemplary embodiments described herein are illustrative and not restrictive. Although one or more embodiments of the present invention have been described with reference to the accompanying drawings, it will be understood by those of ordinary skill in the art that various changes in form and details may be made therein without departing from the spirit and scope of the present invention as defined by the following claims.

Claims (5)

1. An Ethernet sharing method based on an Android system is characterized by comprising the following steps:
s1, turning on the Ethernet sharing switch, including adding an Ethernet sharing switch button in the setting interface to provide a code interface, or integrating the switch function into APK source code, setting the interface function for turning on the Ethernet sharing, and designating a turn-on parameter to complete the turn-on function;
s2, judging whether the Ethernet is ready, if the Ethernet is ready, continuing the next step, otherwise returning an error message to prompt the sharing failure;
s3, judging a designated source network and judging whether the source network is ready, judging whether the designated network is successfully connected or not by calling a method of checking whether the network is connected or not in an Android self-contained network management tool class by the system, if the network is connected and the source network is ready, taking the network as the source network shared by the Ethernet, and if the network is not connected and the source network is not ready, returning a corresponding error code;
s4, configuring information including the network segment of the subnet and the DNS;
s5, starting DHCP service and network forwarding, and entering into network sharing state.
2. The Android system-based Ethernet sharing method of claim 1, wherein S2 specifically comprises: firstly, finding out a network node of the Ethernet, monitoring the connection state change information of a bottom Ethernet port through the node, if the Linkup information of the port appears, successfully connecting an Ethernet link layer, indicating that the Ethernet is ready, and using the Ethernet as a shared network; if the information of the Link down appears, the Ethernet Link layer is disconnected, the Ethernet can not be used as a sharing network at the moment, the Ethernet sharing fails, and if the sharing is opened before, the Ethernet sharing function is closed at the moment.
3. The Android system-based Ethernet sharing method of claim 1, wherein S4 specifically comprises: in the specific code for starting the network sharing function, the original fixed IP address and DNS function are deleted, in the configuration of the Ethernet interface, the appointed IP address and DNS variable information are read from a memory each time, the appointed IP address pool is allocated after the shared service is started, the shared service is configured in the DHCP service, the IP address obtained by the network equipment is in the configured network segment, or the appointed DNS address is configured in the DNS service of the system, and the network management service interface is called to set the appointed DNS server.
4. The Ethernet sharing method based on the Android system as claimed in any one of claims 1 to 3, further comprising monitoring connection states and information of all subnet devices, if a user needs to monitor the connection states of the subnet devices, the user needs to register a network listener first, call a network monitoring module to register a listener, periodically send a network packet to all subnet devices, judge the connection state by checking network packet conditions replied by all subnet devices, if the reply can be received, the subnet device is in the connection state, otherwise, the subnet device is disconnected; if the result of the check is different from the last time, a state change notification is sent to the monitor and is accompanied with specific state change information, and if monitoring needs to be stopped, a network monitoring module is called.
5. The Android system-based Ethernet sharing method of any one of claims 1 to 3, further comprising providing an API interface for a client to switch on and off the Ethernet sharing and adjust the configuration of the Ethernet sharing in a program.
CN202110810286.XA 2021-07-16 2021-07-16 Ethernet sharing method based on Android system Active CN113543147B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110810286.XA CN113543147B (en) 2021-07-16 2021-07-16 Ethernet sharing method based on Android system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110810286.XA CN113543147B (en) 2021-07-16 2021-07-16 Ethernet sharing method based on Android system

Publications (2)

Publication Number Publication Date
CN113543147A true CN113543147A (en) 2021-10-22
CN113543147B CN113543147B (en) 2024-02-13

Family

ID=78128500

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110810286.XA Active CN113543147B (en) 2021-07-16 2021-07-16 Ethernet sharing method based on Android system

Country Status (1)

Country Link
CN (1) CN113543147B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1444363A (en) * 2002-03-13 2003-09-24 磊讯(上海)软件科技有限公司 Method for implementing Ethernet local area network in public place
CN103220283A (en) * 2013-04-08 2013-07-24 北京小米科技有限责任公司 Method, equipment and system for network sharing
CN105227693A (en) * 2015-09-30 2016-01-06 青岛海信移动通信技术股份有限公司 The collocation method of a kind of DNS of mobile device and device
CN110752975A (en) * 2019-09-30 2020-02-04 山东信通电子股份有限公司 Network sharing method and device
KR102241501B1 (en) * 2020-10-26 2021-04-16 (주)한드림넷 Method of terminal controlling heterogeneous communication interfaces and apparatuf thereof

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1444363A (en) * 2002-03-13 2003-09-24 磊讯(上海)软件科技有限公司 Method for implementing Ethernet local area network in public place
CN103220283A (en) * 2013-04-08 2013-07-24 北京小米科技有限责任公司 Method, equipment and system for network sharing
CN105227693A (en) * 2015-09-30 2016-01-06 青岛海信移动通信技术股份有限公司 The collocation method of a kind of DNS of mobile device and device
CN110752975A (en) * 2019-09-30 2020-02-04 山东信通电子股份有限公司 Network sharing method and device
KR102241501B1 (en) * 2020-10-26 2021-04-16 (주)한드림넷 Method of terminal controlling heterogeneous communication interfaces and apparatuf thereof

Also Published As

Publication number Publication date
CN113543147B (en) 2024-02-13

Similar Documents

Publication Publication Date Title
US10693788B2 (en) Network validation with dynamic tunneling
EP2057790B1 (en) Apparatus and method for selecting an access interface dependent on the services offered in the available networks
KR100528156B1 (en) Nomadic Translator or Router
US7545753B2 (en) System, method and computer program product for providing quality of service during remote access to a plug-and-play network
US9386629B2 (en) Wireless access point device and wireless network system with the same
US8964765B2 (en) Mobile handheld multi-media gateway and phone
EP2858306B1 (en) Data transmission method, device and gateway
EP2991278B1 (en) Method and system for managing network traffic
CN110875857B (en) Method, device and system for reporting disconnected network state
CN107770087A (en) Router switching method and device of the Internet of Things based on connection quantity
CN105636086A (en) Network mode switching processing method, network mode switching processing device and terminal comprising network mode switching processing device
CN110784391B (en) Method, device, storage medium and terminal for communication between small base station and gateway
DK1817892T3 (en) PROCEDURE AND SYSTEM TO OPEN A NETWORK LINK
JP2015050656A (en) Data communication system and communication network connection method
CN113543147A (en) Ethernet sharing method based on Android system
CN111163463A (en) Method, device, equipment and storage medium for accessing wireless equipment to router
CN105792385B (en) Communication method and device based on wireless local area network
EP3340046B1 (en) Method for accessing local network, and related device
CN114024903A (en) Network switching method and device and gateway equipment
CN111385371B (en) MAC address acquisition method, device and equipment
US11310076B2 (en) High-availability secure communication system
US20220053095A1 (en) Enterprise telephony interconnect service
Bag et al. Wireless building automation devices supporting multiple standards: Challenges and feasibility
Sicard et al. An ad-hoc network of android phones using BATMAN
WO2023284367A1 (en) Dbng-up backup method and apparatus

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