0

I am developing an application where I have to turn on the Hotspot and get the information of client which connected to this Hotspot.

It seems can not turn on the Hotspot via objective-C.

If I turn on the Hotspot on My iPhone settings. Is it possible to get the information of client , like IP address , MAC address ??

like the following:

Client List

IP :192.168.XX.XX

MAC :XX:XX:XX:XX:XX:XX

The question:1

Can I turn on the hotspot via objective-c in iOS 7?

The question:2

Is it possible to get the information of client(like IP address , MAC address) which connected to this hotspot ??

Martin
  • 2,813
  • 11
  • 43
  • 66

2 Answers2

3

Your question #2 requirements meets structure names ARP table

so all you need is play with code provided in those answers and make it work on interface that linked to Hotspot:

Getting ARP table on iPhone/iPad

How do I query the ARP table on iPhone?

Community
  • 1
  • 1
sage444
  • 5,661
  • 4
  • 33
  • 60
  • So...Does the `hotspot server` must be use the `ARP table` to get the client ? Is it for Apple API ? – Martin Apr 03 '14 at 02:07
  • ARP table is system wide structure, to create any network connection operation system first resolve hardware address and store it in ARP table. This true for any OS, and not related to API. In other words hotspot just won't work without ARP. – sage444 Apr 03 '14 at 06:10
  • @sager444 Excuse me , I am new for this. **It seems the `ARP` can get the `MAC address` from the known IP address , wright ?** But How do I know the `IP address` of client which connected to the `Hotspot` server ? – Martin Apr 05 '14 at 08:58
  • or **Can I get the both of IP address and MAC address from the ARP table ?** – Martin Apr 05 '14 at 09:01
  • ok. Let me explain. Hotspot software assign ip address to each client that connected and write row with `ip` and `mac` (and some other data like ttl, but this not related to our problem) to system ARP table (for caching), as you already know ARP is protocol that resolve `mac` to `ip` and ARP table is cache of currently known network clients. @Martin if this is still not clean for you, feel free to ask. – sage444 Apr 05 '14 at 11:07
  • I have saw the link , but I don't understand how the code work...I am new in objective-c. Should I call `-(NSString*) ip2mac: (char*) ip` for get the `IP address` in `ARP table` ? – Martin Apr 08 '14 at 03:13
  • or How to use it ? only cop and past the code and call the function in first link [Getting ARP table on iPhone/iPad](http://stackoverflow.com/questions/10395041/getting-arp-table-on-iphone-ipad)? – Martin Apr 08 '14 at 06:00
  • This code looks for only one mac/ip, you need a bit rewrite it to get entire table. Yes for first look this samples too hard, but if you play with debugger and read manual about functions and structures you will can use it. I think there is no another way to get info you want so adopt those examples or don't do this at all. Oh yes, you can ask another question maybe someone do it for you. – sage444 Apr 08 '14 at 06:27
  • Thanks for your reply. I have search for this link [Get router mac (without system call for ARP) in Objective-C](http://stackoverflow.com/questions/2189200/get-router-mac-without-system-call-for-arp-in-objective-c). I am not sure , but it seem can dump the entire arp table. I will try it. – Martin Apr 08 '14 at 06:35
  • Excuse me , I have add the code in [How do I query the ARP table on iPhone?](http://stackoverflow.com/questions/2258172/how-do-i-query-the-arp-table-on-iphone). But I am not familiar with Objective-C. How to call the function `-(NSString*) ip2mac: (char*) ip` ? – Martin Apr 09 '14 at 03:50
1

There is no API for that. the hotspot isnt part of your app.

Daij-Djan
  • 49,552
  • 17
  • 113
  • 135