Android Question Identifying a device connected to a router

Discussion in 'Android Questions' started by rodmcm, Jul 20, 2019.

  1. rodmcm

    rodmcm Active Member Licensed User

    I am venturing into an area that I am trying to learn about, so sorry I might be asking the most basic of questions.

    I have a field device that automatically connects to a local router.

    I have an app on a phone that is connected to the same router.

    I can scan the router through the App and list the IP and mac addresses of all connected devices. But the app of course cannot know in advance the IP address the router assigns to positively identify the field device.

    Also, as I understand, if there are several field devices connected with the same sending processor the mac addresses would be the same, ie linked to the manufacturer and the processor, so this is not unique to the device either.

    So what other mechanisms are available to positively identify an individual device from or after the scan?
  2. KMatle

    KMatle Expert Licensed User

    Some routers have a rest api where you can check all devices (via OkHttpUtils). Check your routers documentation.
  3. rodmcm

    rodmcm Active Member Licensed User

    Yes, but what if I sell the APP and the device to a third party?
  4. emexes

    emexes Well-Known Member Licensed User

    Are there any benign queries that you can send to the device, eg, retrieve firmware version, serial number, model number, perform a reading? If you get a valid response, then it is probably your device.

    Or, have you decided upon a random (non-standard) port number for your device to communicate through? If so, then just getting any response on that port will filter out most other devices and thus increase the likelihood of this device being one of yours. Although some firewalls get a bit narky about non-standard port numbers, so that might be opening a new can of worms :-/

    It sounded like you might be querying the router for a list of attached devices. This won't work on every router. Two other approaches are:
    1/ transmit a broadcast packet (usually IP address or to which your device can respond with "here I am" (or perhaps: "here weIare"...)
    2/ scan through the other 253 addresses (excluding x.x.x.0, the router address and your address) and see if you can get a valid response from your device
    Last edited: Jul 21, 2019
  5. rodmcm

    rodmcm Active Member Licensed User

    Thanks for that
    How does the IDE bridge identify my tablet or cell phone by name, also I note some IP scanner apps identify AppleTV etc What is this mechanism or where can I research it.
  6. emexes

    emexes Well-Known Member Licensed User

    Hmm. Windows SMB networking had names, I've never thought about what IP does. DNS links names and IP addresses, but individual devices like an AppleTV aren't going to be listed in that. My first guesses would be:

    - probe the device with a variety of common requests, see if it responds to any of them - I am guessing that Apple have a standard identity-enquiry command implemented on all their networkable devices, especially those where the firmware can be updated over the network
    - MAC addresses assigned in blocks to manufacturers? (similar to IP geolocation)
  7. rodmcm

    rodmcm Active Member Licensed User

    Found it... Its under the phone library in B4A so not what I need
  8. emexes

    emexes Well-Known Member Licensed User

    First promising result (Great minds think alike ;-)

    Fing also attempts to figure out your connected devices' brands and models - a lookup technique ... devices' IP addresses and MAC addresses sent to the app's "Fingpedia" service ... tap on any specific device in your list, Fing lets you add a specific name, a description of what the device is
    Last edited: Jul 21, 2019
  9. emexes

    emexes Well-Known Member Licensed User

    Found what?
    Hang on: does that mean: it is what you need, but Google Play won't allow it?
  10. emexes

    emexes Well-Known Member Licensed User

  11. Erel

    Erel Administrator Staff Member Licensed User

  12. warwound

    warwound Expert Licensed User

  13. LucaMs

    LucaMs Expert Licensed User

    Jorge M A likes this.
  14. Didier9

    Didier9 Active Member Licensed User

    This is incorrect. MAC addresses are supposed to be unique. Manufacturers buy series of MAC addresses (for Ethernet, it's the IEEE that sells them, or at least used to) and program unique addresses in their devices.

    The only case where you may find non-unique addresses is in hobby kits if the seller does not bother to obtain and program unique addresses.

    If you build your own device from scratch, you can buy devices that contain a unique MAC address such as those from Microchip:

    I build WiFi and Bluetooth enabled devices and I always come across the issue of a series of devices looking the same when scanning so the first thing I do is change the name by adding the last 4 digits of the MAC address. For instance, when using the ubiquitous HC-05 Bluetooth module, I change the name from HC-05 to HC05-XXXX where XXXX are the last 4 digits of the MAC address and I put a label on the device itself with that number. That name is not unique (it does not have to be, only the full 32 bits MAC address needs to be) but unique enough to allow me to select one HC-05 among a number of them that are linked to my phone.
    emexes likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice