CN111385371A - MAC address acquisition method, device and equipment - Google Patents
MAC address acquisition method, device and equipment Download PDFInfo
- Publication number
- CN111385371A CN111385371A CN201811628126.8A CN201811628126A CN111385371A CN 111385371 A CN111385371 A CN 111385371A CN 201811628126 A CN201811628126 A CN 201811628126A CN 111385371 A CN111385371 A CN 111385371A
- Authority
- CN
- China
- Prior art keywords
- user terminal
- mac address
- access point
- wireless access
- address
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L2101/00—Indexing scheme associated with group H04L61/00
- H04L2101/60—Types of network addresses
- H04L2101/618—Details of network addresses
- H04L2101/622—Layer-2 addresses, e.g. medium access control [MAC] addresses
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W8/00—Network data management
- H04W8/22—Processing or transfer of terminal data, e.g. status or physical capabilities
- H04W8/24—Transfer of terminal data
- H04W8/245—Transfer of terminal data from a network towards a terminal
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Databases & Information Systems (AREA)
- Mobile Radio Communication Systems (AREA)
Abstract
The embodiment of the invention provides a method, a device and equipment for obtaining an MAC address, wherein the method comprises the following steps: the user terminal establishes transmission layer communication connection with the first wireless access point; transmitting an MAC address query request to a first wireless access point through a transport layer communication connection, wherein the MAC address query request comprises an IP address of a user terminal, so that the first wireless access point queries a historical connection record according to the IP address of the user terminal to obtain the MAC address of the user terminal; and receiving the MAC address of the user terminal sent by the first wireless access point. Thus, the user terminal indirectly obtains its own MAC address through the connected wireless access point.
Description
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method, an apparatus, and a device for acquiring an MAC address.
Background
With the development of mobile internet, people can surf the internet through user terminals such as mobile phones, tablet computers, intelligent wearable devices and the like anytime and anywhere.
There is also a need to uniquely identify a device in the network world. Wherein one unique identifier of the device is: media Access Control (MAC) address. In some application scenarios, the MAC address of the user terminal needs to be acquired. Therefore, how to acquire the MAC address of the user terminal is a problem to be solved.
Disclosure of Invention
The embodiment of the invention provides a method, a device and equipment for acquiring an MAC address, which are used for acquiring the MAC address of a user terminal through a wireless access point.
In a first aspect, an embodiment of the present invention provides a MAC address obtaining method, which is applied to a user terminal, and the method includes:
establishing a transport layer communication connection with a first wireless access point;
sending a MAC address query request to the first wireless access point through the transport layer communication connection, wherein the MAC address query request comprises an IP address of the user terminal, so that the first wireless access point queries a historical connection record according to the IP address to obtain the MAC address of the user terminal;
and receiving the MAC address of the user terminal sent by the first wireless access point.
In a second aspect, an embodiment of the present invention provides an apparatus for acquiring a MAC address, where the apparatus is applied to a user terminal, and the apparatus includes:
the connection module is used for establishing transmission layer communication connection with the first wireless access point;
a sending module, configured to send a MAC address query request to the first wireless access point through the transport layer communication connection, where the MAC address query request includes an IP address of the user equipment, so that the first wireless access point queries a historical connection record according to the IP address to obtain the MAC address of the user equipment;
a receiving module, configured to receive the MAC address of the user equipment sent by the first wireless access point.
In a third aspect, an embodiment of the present invention provides an electronic device, which includes a first processor and a first memory, where the first memory is configured to store one or more computer instructions, and when the one or more computer instructions are executed by the first processor, the MAC address obtaining method in the first aspect is implemented.
An embodiment of the present invention provides a computer storage medium, configured to store a computer program, where the computer program enables a computer to implement the MAC address obtaining method in the first aspect when executed.
In a fourth aspect, an embodiment of the present invention provides a MAC address obtaining method, which is applied to a wireless access point, and the method includes:
establishing a transport layer communication connection with a user terminal;
receiving an MAC address query request sent by the user terminal through the transport layer communication connection, wherein the MAC address query request comprises an IP address of the user terminal;
inquiring a historical connection record according to the IP address to obtain the MAC address of the user terminal;
and sending the MAC address of the user terminal to the user terminal.
In a fifth aspect, an embodiment of the present invention provides an apparatus for acquiring a MAC address, where the apparatus is applied to a wireless access point, and the apparatus includes:
the connection module is used for establishing transmission layer communication connection with the user terminal;
a receiving module, configured to receive an MAC address query request sent by the user terminal through the transport layer communication connection, where the MAC address query request includes an IP address of the user terminal;
the acquisition module is used for inquiring the historical connection record according to the IP address so as to obtain the MAC address of the user terminal;
and the sending module is used for sending the MAC address of the user terminal to the user terminal.
In a sixth aspect, an embodiment of the present invention provides an electronic device, which includes a second processor and a second memory, where the second memory is configured to store one or more computer instructions, and when the one or more computer instructions are executed by the second processor, the MAC address obtaining method in the fourth aspect is implemented.
An embodiment of the present invention provides a computer storage medium, configured to store a computer program, where the computer program enables a computer to implement the MAC address obtaining method in the fourth aspect when executed.
The MAC address acquisition method provided by the embodiment of the invention can acquire the MAC address of the user terminal through the wireless access point. Specifically, first, a user terminal establishes a transport layer communication connection with a certain wireless access point, and then, based on the transport layer communication connection, the user terminal sends an MAC address query request to the wireless access point, the wireless access point queries a historical connection record according to an IP address of the user terminal included in the MAC address query request to obtain an MAC address of the user terminal, and sends the obtained MAC address to the user terminal, so that the user terminal indirectly obtains its own MAC address through the wireless access point to which the user terminal is connected.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
Fig. 1 is a schematic diagram illustrating a MAC address obtaining system according to an embodiment of the present invention;
fig. 2 is a flowchart of a MAC address obtaining method according to an embodiment of the present invention;
fig. 3 is a flowchart of another MAC address obtaining method according to an embodiment of the present invention;
fig. 4 is an interaction diagram of a MAC address obtaining process according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an MAC address obtaining apparatus according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of an electronic device corresponding to the MAC address obtaining apparatus provided in the embodiment shown in fig. 5;
fig. 7 is a schematic structural diagram of another MAC address obtaining apparatus according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of an electronic device corresponding to the MAC address obtaining apparatus in the embodiment shown in fig. 7.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, 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, but 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.
The terminology used in the embodiments of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the examples of the present invention and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, and "a" and "an" generally include at least two, but do not exclude at least one, unless the context clearly dictates otherwise.
It should be understood that the term "and/or" as used herein is merely one type of association that describes an associated object, meaning that three relationships may exist, e.g., a and/or B may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship.
The words "if", as used herein, may be interpreted as "at … …" or "at … …" or "in response to a determination" or "in response to a detection", depending on the context. Similarly, the phrases "if determined" or "if detected (a stated condition or event)" may be interpreted as "when determined" or "in response to a determination" or "when detected (a stated condition or event)" or "in response to a detection (a stated condition or event)", depending on the context.
It is also noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a good or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such good or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a commodity or system that includes the element.
In addition, the sequence of steps in each method embodiment described below is only an example and is not strictly limited.
Fig. 1 is a schematic diagram illustrating a MAC address obtaining system according to an embodiment of the present invention, and as shown in fig. 1, the system may include: at least one wireless access point and a user terminal. The at least one wireless access point illustrated in fig. 1 includes a wireless access point a, a wireless access point B, and a wireless access point C. The at least one wireless access point belongs to the same local area network.
In practical applications, the user terminal may execute the process of obtaining its MAC address based on the trigger of an application installed therein, such as an instant messaging application, management software in a company, and the like. The user terminal can be a mobile phone, a tablet computer and other terminal equipment.
In this embodiment, the ue may obtain its MAC address through a corresponding wireless access point in the wlan.
In order to obtain the MAC address of a user terminal through a certain wireless access point in a wireless lan, the user terminal needs to join the wireless lan, and then the user terminal establishes a transport layer communication connection with the certain wireless access point in the wireless lan.
The mode of adding the user terminal into the wireless local area network is as follows: the user selects a certain wireless access point in the network connection configuration interface of the user terminal and inputs an access password for connecting the wireless access point, so that physical layer communication connection is established with the wireless access point, and the establishment of the physical layer communication connection means that the user terminal joins the wireless local area network. In connection with fig. 1, it is assumed that the user selects the wireless access point a in fig. 1, inputs the access password of the wireless access point a, and thus accesses the wireless lan through the physical layer communication connection established with the wireless access point a.
After the user terminal joins the wireless local area network, the user terminal can establish a transmission layer communication connection with one wireless access point. The wireless access point establishing a physical layer communication connection with the user terminal and the wireless access point establishing a transport layer communication connection with the user terminal may be the same or different. It is assumed that the user terminal establishes a transport layer communication connection with the wireless access point B in the wireless local area network shown in fig. 1.
Specifically, the process of establishing the transport layer communication connection between the user terminal and the wireless access point B may be: based on a Simple Service Discovery Protocol (SSDP), a user terminal multicast a Service Discovery packet in a wireless lan, where the Service Discovery packet is used to discover a device capable of acquiring an MAC address of the user terminal. Each wireless access point receiving the service discovery message may respond to the service discovery message, that is, all the wireless access points a, B, and C in the wireless local area network may send service response messages to the user terminal, where the service response messages include an IP address and a port number of the corresponding wireless access point, where the port number corresponds to a port for starting a transport layer protocol. The transport layer Protocol may be a Transmission Control Protocol (TCP), or may be a User Datagram Protocol (UDP). The user terminal can select the required service response message from the received service response messages based on a certain rule, so that the transmission layer communication connection is established with the corresponding wireless access point according to the IP address and the port number carried in the selected service response message. Assuming that the user terminal selects the service response message sent by the wireless access point B, a transport layer communication connection, i.e. a TCP connection or a UDP connection, is established with the wireless access point B according to the IP address of the wireless access point B and the port number corresponding to the transport layer protocol.
The rule may be, for example: the service response packet that responds to the service discovery packet first is selected, or the service response packet with the best network quality is selected.
On the basis of establishing a transport layer communication connection with the wireless access point B, the user terminal may send a MAC address query request to the wireless access point B through the transport layer communication connection, where the MAC address query request includes an IP address of the user terminal. The wireless access point B inquires the historical connection record according to the IP address of the user terminal to obtain the MAC address of the user terminal and sends the obtained MAC address of the user terminal to the user terminal.
Specifically, the historical connection record corresponding to the wireless access point B may be a historical connection record of the wireless access point B itself, or may include a historical connection record of another wireless access point obtained by the wireless access point B from another wireless access point in the wireless local area network. In practical applications, the historical connection record may be implemented as an Address Resolution Protocol (ARP) buffer table of the wireless access point, in which a mapping relationship between an IP Address and an MAC Address of a user terminal accessing the wireless access point is stored. Thus, based on the mapping relationship, the wireless access point B can inquire and obtain the MAC address of the user terminal.
The above embodiments generally describe an implementation manner in which the user terminal obtains its MAC address through the wireless access point. The MAC address acquisition method provided by the embodiments of the present invention is described in detail below with respect to a wireless access point and a user terminal, respectively.
Fig. 2 is a flowchart of a MAC address obtaining method according to an embodiment of the present invention, where the MAC address obtaining method may be executed by the user terminal shown in fig. 1. As shown in fig. 2, the method comprises the steps of:
201. a transport layer communication connection is established with a first wireless access point.
The first wireless access point may be one of the wireless access points in the wireless lan shown in fig. 1.
Alternatively, if the ue has previously accessed the wlan, the ue may directly send a service discovery message (which may be referred to as an SSDP M-Search message) by multicast in the wlan, select a service Response message with a first Response from service Response messages (which may be referred to as SSDP Response messages) fed back by each of the wireless access points, and establish a transport layer communication connection with a wireless access point (serving as a first wireless access point) corresponding to the service Response message with the first Response.
The service response message which is responded firstly is the service response message which is received firstly.
Alternatively, if the user terminal has not accessed the wireless local area network, the user terminal needs to access the wireless local area network first. Specifically, the user terminal searches for wireless access points existing around under the operation control of the user, and then the user selects one of the searched wireless access points (assuming that the selected wireless access point is referred to as a second wireless access point) and inputs an access password corresponding to the second wireless access point, so that the user terminal accesses a corresponding wireless local area network by establishing a physical layer communication connection with the second wireless access point. After joining the wireless lan, a transport layer communication connection is established with a first wireless access point in the lan through the service discovery procedure described above, where the first wireless access point may be the same as or different from a second wireless access point.
As described above, in the embodiment of the present invention, the user terminal may execute the process of acquiring the MAC address thereof only in response to the trigger of the application program in the user terminal, that is, in response to the trigger of the application program in the user terminal, execute step 201 and the following steps.
The condition for acquiring the MAC address of the user terminal can be set in the application program, and when the condition is met, the user terminal is triggered to acquire the MAC address of the user terminal. For example, the condition may be when the user logs into the application.
It should be noted that if the user terminal does not access the wireless lan yet when the application is triggered, the application may prompt the user to access the wireless lan. If the user terminal has accessed the wireless local area network when the application program is triggered, the user terminal can execute multicast sending of the service discovery message in the wireless local area network based on the triggering of the application program.
202. And sending a MAC address query request to the first wireless access point through the transport layer communication connection, wherein the MAC address query request comprises the IP address of the user terminal, so that the first wireless access point queries the historical connection record according to the IP address of the user terminal to obtain the MAC address of the user terminal.
203. And receiving the MAC address of the user terminal sent by the first wireless access point.
Under the condition that an application program in the user terminal triggers the user terminal to obtain the MAC address of the user terminal, the MAC address can be stored locally after the user terminal obtains the MAC address of the user terminal, and the MAC address of the user terminal and user information corresponding to the application program can also be sent to a server. The user information of the application program may be a user account, i.e., a user name, of a user logging in the application program.
The following description is made in conjunction with the following practical application scenarios to schematically illustrate the role of acquiring the MAC address of the user terminal.
In an optional embodiment, the user information of the application and the MAC address of the user terminal are sent to the server, so that the server can control the access behavior triggered by the user through a certain user terminal.
Specifically, the user terminal may send an access request to the server, the access request including user information of the application and the MAC address of the user terminal. After receiving the access request, the server may determine whether the user terminal has the access right according to the MAC address of the user terminal, and if so, may feed back a corresponding access response to the user terminal, otherwise, may send an error notification message to the user terminal if not.
For example, the access request may be triggered when a user logs in an application program, so that, optionally, in response to a login operation of the user on the application program, the user terminal obtains its MAC address, and carries the MAC address and user information input when the user logs in the login request to send to the server, and the server finds that, if the number of user terminals that have logged in the same user information has reached a preset value, it is determined that the current user terminal does not have login permission. In this example, the MAC address of the user terminal is used as its unique identifier, which means that if the number of MAC addresses corresponding to the same user information reaches a preset value, the current user terminal does not have login authority.
For another example, the access request may be triggered when the user accesses a specific page of the application. In this case, alternatively, in response to a login operation of the application by the user, the user terminal acquires its own MAC address. It can be understood that, when a user can log in the application program through different user terminals, different user terminals can obtain the corresponding relationship between the same user information and their own MAC addresses. Based on the method, when a user accesses a specific page of an application program through a certain user terminal, an access request aiming at the page is sent to a server, and the access request comprises user information and the MAC address of the user terminal. If the server side presets that only a certain user terminal can access the page, namely, the corresponding relation among the page, the user information and the MAC address of the user terminal is preset. Therefore, if the MAC address of the user terminal carried in the access request sent by the server is not in accordance with the corresponding relation, the user terminal is determined not to have the access right of the page.
In another alternative embodiment, the user terminal may also store its MAC address locally after obtaining the MAC address. The local storage of the MAC of the ue enables the MAC address of the ue to be obtained directly from the local without re-performing the above steps to obtain the MAC address when the MAC address of the ue needs to be obtained subsequently. For example, in response to switching of user information of a login application, a correspondence between newly logged-in user information and the MAC address of the user terminal is established. In practical applications, an application installed in the same user terminal may allow logging in different user accounts. Assume a condition for triggering the ue to acquire its MAC address is: when the logged user account is switched, because the MAC address of the user terminal is obtained and locally stored when certain user information is logged in before, the stored MAC address of the user terminal can be directly and locally obtained when the user account is switched.
In summary, when the MAC address of the user terminal needs to be obtained, the MAC address of the user terminal can be indirectly obtained through the wireless access point in the wireless lan to which the user terminal is accessed.
Fig. 3 is a flowchart of another MAC address obtaining method according to an embodiment of the present invention, where the MAC address obtaining method may be executed by the wireless access point shown in fig. 1. As shown in fig. 3, the following steps may be included:
301. and establishing a transport layer communication connection with the user terminal.
As described above, optionally, the wireless access point establishing the transport layer communication connection with the user terminal in this embodiment may be any one of the wireless access points in the wireless local area network, and the user terminal may access the wireless local area network through the wireless access point or another wireless access point in the wireless local area network.
Specifically, the establishing of the transport layer communication connection between the radio access point and the user terminal may be implemented as:
receiving a service discovery message sent by a user terminal in a wireless local area network in a multicast mode, wherein the service discovery message is used for discovering equipment capable of acquiring an MAC (media access control) address of the user terminal;
and sending a service response message to the user terminal, wherein the service response message comprises the IP address and the port number of the wireless access point, and the port number corresponds to the port for starting the transport layer protocol, so that the user terminal establishes transport layer communication connection with the wireless access point according to the IP address and the port number of the wireless access point.
The detailed implementation of the above process can be referred to the description in the foregoing embodiments, and is not described herein.
302. And receiving an MAC address query request sent by the user terminal through the transport layer communication connection, wherein the MAC address query request comprises the IP address of the user terminal.
303. And inquiring the historical connection record according to the IP address of the user terminal to obtain the MAC address of the user terminal.
304. And sending the MAC address of the user terminal to the user terminal.
For the detailed description that is not repeated in this embodiment, reference may be made to the description in the foregoing embodiments.
Fig. 4 is an interaction diagram of a MAC address obtaining process according to an embodiment of the present invention, and as shown in fig. 4, in this embodiment, an example in which a certain instant messaging application running in a user terminal triggers the user terminal to obtain its own MAC address is described. Also, the wireless access point illustrated in fig. 4 may be any one of wireless access points in a wireless local area network. The process of acquiring the MAC address of the user terminal may include the steps of:
401. the wireless access point starts the TCP Server service.
402. The wireless access point initiates the SSDP Server service.
The two steps are not strictly limited in the execution order. The wireless access point can complete the start of the two services at the stage of power-on initialization. The TCP Server service means that the wireless access point starts a TCP protocol at a certain port, and the SSDP Server service means that the wireless access point starts an SSDP protocol.
403. And the user terminal establishes WiFi connection with the wireless access point.
The WiFi connection is communication connection of a physical layer, and through the WiFi connection, the user terminal is added into a wireless local area network to which the wireless access point belongs.
404. And responding to the trigger of the instant messaging application program, and multicasting and sending an SSDP M-Search message by the user terminal for searching equipment for acquiring the MAC address of the user terminal.
405. The wireless access point feeds back an SSDP Response message to the user terminal, wherein the SSDP Response message comprises an IP address of the wireless access point and a port number for starting a TCP Server service.
406. And the user terminal establishes TCP connection with the wireless access point according to the IP address of the wireless access point and the port number for starting the TCP Server service.
407. The user terminal sends a MAC address query request, including the IP address of the user terminal, to the wireless access point over the TCP connection.
408. The wireless access point inquires an ARP table according to the IP address of the user terminal so as to obtain the MAC address of the user terminal.
409. The wireless access point sends the MAC address of the user terminal to the user terminal.
410. The instant messaging application in the user terminal sends an access request to the server including the MAC address of the user terminal and the user information.
411. And the server verifies the access authority of the access request according to the MAC address of the user terminal and the user information.
The MAC address acquisition apparatus according to one or more embodiments of the present invention will be described in detail below. Those skilled in the art will appreciate that these MAC address acquisition devices can each be configured using commercially available hardware components through the steps taught in this scheme.
Fig. 5 is a schematic structural diagram of an MAC address obtaining apparatus according to an embodiment of the present invention, as shown in fig. 5, the apparatus includes: a connection module 11, a sending module 12 and a receiving module 13.
A connection module 11, configured to establish a transport layer communication connection with a first wireless access point.
A sending module 12, configured to send a MAC address query request to the first wireless access point through the transport layer communication connection, where the MAC address query request includes an IP address of the user equipment, so that the first wireless access point queries a historical connection record according to the IP address to obtain the MAC address of the user equipment.
A receiving module 13, configured to receive the MAC address of the user equipment sent by the first wireless access point.
Optionally, the connection module 11 may be specifically configured to: accessing a wireless local area network according to an access password of a second wireless access point, wherein the second wireless access point is the same as or different from the first wireless access point; multicasting and sending a service discovery message in the wireless local area network through the sending module 12, wherein the service discovery message is used for discovering equipment capable of acquiring the MAC address of the user terminal; receiving, by the receiving module 13, a service response packet sent by the first wireless access point, where the service response packet includes an IP address and a port number of the first wireless access point, and the port number corresponds to a port for starting a transport layer protocol; and establishing a transport layer communication connection with the first wireless access point according to the IP address and the port number of the first wireless access point.
Optionally, the first wireless access point is a wireless access point that responds to the service discovery packet first in the wireless local area network.
Optionally, the connection module 11 may be specifically configured to: and responding to the trigger of an application program in the user terminal, and establishing a transmission layer communication connection with the first wireless access point.
Optionally, the sending module 12 may be further configured to: and sending an access request to the server, wherein the access request comprises the MAC address of the user terminal and the user information corresponding to the application program. The receiving module 13 may further be configured to: and receiving an access response sent by the server, wherein the access response is sent when the server determines that the user terminal has the access authority according to the MAC address of the user terminal corresponding to the user information.
Optionally, the apparatus further comprises:
the storage module is used for locally storing the MAC address of the user terminal; and responding to the switching of the user information for logging in the application program, and establishing the corresponding relation between the newly logged user information and the MAC address of the user terminal.
The apparatus shown in fig. 5 may perform the steps performed by the user terminal in the embodiments shown in fig. 1 to fig. 4, and for parts not described in detail in this embodiment, reference may be made to the related descriptions of the foregoing related embodiments, which are not described herein again.
In one possible design, the structure of the MAC address obtaining apparatus shown in fig. 5 may be implemented as an electronic device, which may be a user terminal such as a mobile phone, a tablet computer, or the like. As shown in fig. 6, the electronic device may include: a first processor 21 and a first memory 22. Wherein the first memory 22 is used for storing programs, and the first processor 21 is configured for executing the programs stored in the first memory 22.
The program comprises one or more computer instructions which, when executed by the first processor 21, are capable of performing the steps of:
establishing a transport layer communication connection with a first wireless access point;
sending a MAC address query request to the first wireless access point through the transport layer communication connection, wherein the MAC address query request comprises an IP address of the user terminal, so that the first wireless access point queries a historical connection record according to the IP address to obtain the MAC address of the user terminal;
and receiving the MAC address of the user terminal sent by the first wireless access point.
Optionally, the first processor 21 is further configured to perform all or part of the steps performed by the user terminal in the foregoing embodiments.
The electronic device may further include a first communication interface 23, which is used for the electronic device to communicate with other devices or a communication network.
In addition, an embodiment of the present invention provides a computer storage medium for storing computer software instructions for an electronic device, which includes a program for executing the program involved in the MAC address obtaining method executed by the user terminal in the foregoing embodiments.
Fig. 7 is a schematic structural diagram of another MAC address obtaining apparatus according to an embodiment of the present invention, as shown in fig. 7, the apparatus includes: a connection module 31, a receiving module 32, an obtaining module 33, and a sending module 34.
A connection module 31, configured to establish a transport layer communication connection with a user terminal.
A receiving module 32, configured to receive a MAC address query request sent by the ue through the transport layer communication connection, where the MAC address query request includes an IP address of the ue.
An obtaining module 33, configured to query a historical connection record according to the IP address to obtain the MAC address of the user terminal.
A sending module 34, configured to send the MAC address of the user terminal to the user terminal.
Optionally, the wireless access point is one of wireless local area networks, and the user terminal accesses the wireless local area network through the wireless access point or another wireless access point of the wireless local area network.
Optionally, the receiving module 32 may further be configured to: and receiving a service discovery message multicast-sent by the user terminal in the wireless local area network, wherein the service discovery message is used for discovering equipment capable of acquiring the MAC address of the user terminal. The sending module 34 may be further configured to: and sending a service response message to the user terminal, wherein the service response message comprises the IP address and the port number of the wireless access point, and the port number corresponds to a port for starting a transport layer protocol, so that the user terminal establishes transport layer communication connection with the wireless access point according to the IP address and the port number of the wireless access point.
The apparatus shown in fig. 7 may perform the steps performed by the wireless access point in the embodiments shown in fig. 1 to fig. 4, and parts not described in detail in this embodiment may refer to the related descriptions in the foregoing embodiments, which are not described again here.
In one possible design, the structure of the MAC address acquisition apparatus shown in fig. 7 may be implemented as an electronic device that serves as a wireless access point. As shown in fig. 8, the electronic device may include: a second processor 41 and a second memory 42. Wherein the second memory 42 is used for storing programs, and the second processor 41 is configured for executing the programs stored in the second memory 42.
The program comprises one or more computer instructions which, when executed by the second processor 41, are capable of performing the steps of:
establishing a transport layer communication connection with a user terminal;
receiving an MAC address query request sent by the user terminal through the transport layer communication connection, wherein the MAC address query request comprises an IP address of the user terminal;
inquiring a historical connection record according to the IP address to obtain the MAC address of the user terminal;
and sending the MAC address of the user terminal to the user terminal.
Optionally, the second processor 41 is further configured to perform all or part of the steps performed by the wireless access point in the foregoing embodiments.
The electronic device may further include a second communication interface 43 for communicating with other devices or a communication network.
In addition, an embodiment of the present invention provides a computer storage medium for storing computer software instructions for an electronic device, which includes a program for executing the program involved in the MAC address obtaining method executed by the wireless access point in the foregoing embodiments.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by adding a necessary general hardware platform, and of course, can also be implemented by a combination of hardware and software. With this understanding in mind, the above-described aspects and portions of the present technology which contribute substantially or in part to the prior art may be embodied in the form of a computer program product, which may be embodied on one or more computer-usable storage media having computer-usable program code embodied therein, including without limitation disk storage, CD-ROM, optical storage, and the like.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.
Claims (13)
1. A MAC address acquisition method is applied to a user terminal, and the method comprises the following steps:
establishing a transport layer communication connection with a first wireless access point;
sending a MAC address query request to the first wireless access point through the transport layer communication connection, wherein the MAC address query request comprises an IP address of the user terminal, so that the first wireless access point queries a historical connection record according to the IP address to obtain the MAC address of the user terminal;
and receiving the MAC address of the user terminal sent by the first wireless access point.
2. The method of claim 1, wherein establishing the transport layer communication connection with the first wireless access point comprises:
accessing a wireless local area network according to an access password of a second wireless access point, wherein the second wireless access point is the same as or different from the first wireless access point;
multicasting and sending a service discovery message in the wireless local area network, wherein the service discovery message is used for discovering equipment capable of acquiring the MAC address of the user terminal;
receiving a service response message sent by the first wireless access point, wherein the service response message comprises an IP address and a port number of the first wireless access point, and the port number corresponds to a port for starting a transport layer protocol;
and establishing a transport layer communication connection with the first wireless access point according to the IP address and the port number of the first wireless access point.
3. The method of claim 2, wherein the first wireless access point is a wireless access point of the wireless local area network that first responds to the service discovery packet.
4. The method of any of claims 1-3, wherein establishing the transport layer communication connection with the first wireless access point comprises:
and responding to the trigger of an application program in the user terminal, and establishing a transmission layer communication connection with the first wireless access point.
5. The method of claim 4, further comprising:
sending an access request to the server, wherein the access request comprises the MAC address of the user terminal and user information corresponding to the application program;
and receiving an access response sent by the server, wherein the access response is sent when the server determines that the user terminal has the access authority according to the MAC address of the user terminal corresponding to the user information.
6. The method of claim 4, further comprising:
locally storing the MAC address of the user terminal;
and responding to the switching of the user information for logging in the application program, and establishing the corresponding relation between the newly logged user information and the MAC address of the user terminal.
7. A MAC address acquisition method is applied to a wireless access point, and the method comprises the following steps:
establishing a transport layer communication connection with a user terminal;
receiving an MAC address query request sent by the user terminal through the transport layer communication connection, wherein the MAC address query request comprises an IP address of the user terminal;
inquiring a historical connection record according to the IP address to obtain the MAC address of the user terminal;
and sending the MAC address of the user terminal to the user terminal.
8. The method according to claim 7, wherein the wireless access point is one of wireless local area networks, and the user terminal accesses the wireless local area network through the wireless access point or other wireless access points in the wireless local area network.
9. The method of claim 8, wherein establishing a transport layer communication connection with a user terminal comprises:
receiving a service discovery message multicast-sent by the user terminal in the wireless local area network, wherein the service discovery message is used for discovering equipment capable of acquiring the MAC address of the user terminal;
and sending a service response message to the user terminal, wherein the service response message comprises the IP address and the port number of the wireless access point, and the port number corresponds to a port for starting a transport layer protocol, so that the user terminal establishes transport layer communication connection with the wireless access point according to the IP address and the port number of the wireless access point.
10. An MAC address acquisition apparatus, comprising:
the connection module is used for establishing transmission layer communication connection with the first wireless access point;
a sending module, configured to send a MAC address query request to the first wireless access point through the transport layer communication connection, where the MAC address query request includes an IP address of the user equipment, so that the first wireless access point queries a historical connection record according to the IP address to obtain the MAC address of the user equipment;
a receiving module, configured to receive the MAC address of the user equipment sent by the first wireless access point.
11. An electronic device, comprising: a memory, a processor; wherein the memory is to store one or more computer instructions, wherein the one or more computer instructions, when executed by the processor, implement the MAC address acquisition method of any of claims 1 to 6.
12. An MAC address acquisition apparatus, comprising:
the connection module is used for establishing transmission layer communication connection with the user terminal;
a receiving module, configured to receive an MAC address query request sent by the user terminal through the transport layer communication connection, where the MAC address query request includes an IP address of the user terminal;
the acquisition module is used for inquiring the historical connection record according to the IP address so as to obtain the MAC address of the user terminal;
and the sending module is used for sending the MAC address of the user terminal to the user terminal.
13. An electronic device, comprising: a memory, a processor; wherein the memory is to store one or more computer instructions, wherein the one or more computer instructions, when executed by the processor, implement the MAC address acquisition method of any of claims 7 to 9.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811628126.8A CN111385371B (en) | 2018-12-28 | 2018-12-28 | MAC address acquisition method, device and equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811628126.8A CN111385371B (en) | 2018-12-28 | 2018-12-28 | MAC address acquisition method, device and equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111385371A true CN111385371A (en) | 2020-07-07 |
CN111385371B CN111385371B (en) | 2022-10-21 |
Family
ID=71218162
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811628126.8A Active CN111385371B (en) | 2018-12-28 | 2018-12-28 | MAC address acquisition method, device and equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111385371B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114793354A (en) * | 2022-04-13 | 2022-07-26 | 展讯通信(深圳)有限公司 | Information transmission method, communication device, chip and module equipment |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20140006633A1 (en) * | 2012-06-29 | 2014-01-02 | Canon Kabushiki Kaisha | Mobile terminal, service search method, and non-transitory computer-readable medium |
CN103647856A (en) * | 2013-12-23 | 2014-03-19 | 成都西加云杉科技有限公司 | Method and device for application (APP) to obtain media access control (MAC) address of terminal |
CN105227695A (en) * | 2015-10-19 | 2016-01-06 | 深圳市华讯方舟科技有限公司 | Access point based on multiple VLAN obtains method and the device of client mac address |
CN105451221A (en) * | 2015-11-06 | 2016-03-30 | 迈普通信技术股份有限公司 | Terminal roaming realization method, system and wireless access point |
CN107276901A (en) * | 2017-05-27 | 2017-10-20 | 上海斐讯数据通信技术有限公司 | The system and method and wireless router and terminal of integration application |
CN108833607A (en) * | 2018-06-12 | 2018-11-16 | 腾讯科技(深圳)有限公司 | Physical address acquisition methods, device and readable medium |
-
2018
- 2018-12-28 CN CN201811628126.8A patent/CN111385371B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20140006633A1 (en) * | 2012-06-29 | 2014-01-02 | Canon Kabushiki Kaisha | Mobile terminal, service search method, and non-transitory computer-readable medium |
CN103647856A (en) * | 2013-12-23 | 2014-03-19 | 成都西加云杉科技有限公司 | Method and device for application (APP) to obtain media access control (MAC) address of terminal |
CN105227695A (en) * | 2015-10-19 | 2016-01-06 | 深圳市华讯方舟科技有限公司 | Access point based on multiple VLAN obtains method and the device of client mac address |
CN105451221A (en) * | 2015-11-06 | 2016-03-30 | 迈普通信技术股份有限公司 | Terminal roaming realization method, system and wireless access point |
CN107276901A (en) * | 2017-05-27 | 2017-10-20 | 上海斐讯数据通信技术有限公司 | The system and method and wireless router and terminal of integration application |
CN108833607A (en) * | 2018-06-12 | 2018-11-16 | 腾讯科技(深圳)有限公司 | Physical address acquisition methods, device and readable medium |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114793354A (en) * | 2022-04-13 | 2022-07-26 | 展讯通信(深圳)有限公司 | Information transmission method, communication device, chip and module equipment |
CN114793354B (en) * | 2022-04-13 | 2024-02-23 | 展讯通信(深圳)有限公司 | Information transmission method, communication device, chip and module equipment |
Also Published As
Publication number | Publication date |
---|---|
CN111385371B (en) | 2022-10-21 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20230171618A1 (en) | Communication method and apparatus | |
JP6726426B2 (en) | Login-free method and device between terminals | |
CN109587254B (en) | Cloud server access method and device, cloud server and storage medium | |
US10116489B2 (en) | Apparatus and method for managing network access device | |
CN114902634A (en) | Apparatus and method for providing information of application server in mobile communication system | |
US8515350B2 (en) | Resolving an application service change in a system using bluetooth | |
US10630551B2 (en) | Method and apparatus for automatic networking of gateway device | |
CN105959906B (en) | Network equipment communication method and device and network equipment communication method and device | |
EP1774702A1 (en) | System, network entities and computer programs for configuration management of a dynamic host configuration protocol framework | |
CN106686752B (en) | It is a kind of that the method and apparatus being wirelessly connected is established by the first application on user equipment | |
WO2018024121A1 (en) | Network function (nf) management method and nf management device | |
CN112714027B (en) | Method and system for accessing terminal equipment of Internet of things to gateway | |
CN112533177A (en) | Method, device, apparatus and medium for providing and discovering moving edge calculation | |
US20230008647A1 (en) | Connection establishment method, communication apparatus, and system | |
CN105959188B (en) | Method and device for controlling user terminal to be on-line | |
EP3188418B1 (en) | Near field discovery method, user equipment, and storage medium | |
CN115442100A (en) | Data access method based on multi-node zero-trust gateway and related equipment | |
CN105657055A (en) | Local area network equipment finding method and device oriented to WEB page | |
WO2020177020A1 (en) | Internet of things device discovery method, apparatus, and terminal device | |
US20190110323A1 (en) | Access method, apparatus, device, and system | |
CN109788528B (en) | Access point and method and system for opening internet access service thereof | |
CN111385371B (en) | MAC address acquisition method, device and equipment | |
US20240040005A1 (en) | Context transfer method and communication apparatus | |
US10939374B2 (en) | Method and apparatus for remotely waking up a device connected to a network | |
CN109327517B (en) | Method and equipment for acquiring network state of wireless access point |
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 |