What's the strategy of DNS-SD services responding to mDNS query? - iphone

I am trying to gather some information of devices connected on the wifi with DNS-SD. When I use dns-sd -B _services._dns-sd._udp
(OS X)/avahi-browse -t _services._dns-sd._udp(Linux) repeatedly to observe the published services, I get more or less output while devices(Mac and iPhone) are always connected. For example, this service(used by iTunes for Wi-Fi sync) shows occasionally while no one changes the sync setting of the iPhone.
Timestamp A/R Flags if Domain Service Type Instance Name
12:07:40.042 Add 2 4 . _tcp.local. _apple-mobdev2
So it's because the iPhone responses the mDNS query at intervals or something else? What's the strategy of DNS-SD services responding to mDNS query? How can I detect these services more accurately?

Related

How to execute specific services on each iot device connecting on a tcp server?

I have 100K of iot devices connecting on tcp server. I have to select specific services to be executed on each device based on the device id. Right now I am using a rest api, that I call upon when a device connects to the server,which in turn returns the list of services to be executed on the device, these services on each device are selected by users using a web portal, my problem is when all these devices connects at the same time, rest api server goes down or hangs or takes time to serve the request, my need is to get the response back in milliseconds please suggest any better solution that can server my purpose.

How to find IP addresses of devices on local network which are running an instance of my app in Swift?

I'm working on a simple Swift app where one user can find other machines on a local network which are running an instance of my app and then send data to that machine using TCP sockets.
My question is how to find IP addresses of devices on same network which are running an instance of my app (cross-platform)?
I was thinking about listing all devices on local network and then
checking whether they have opened specific port (the port my app is
using)?
I also found that Apple provides service called Bonjour which could make my process discoverable. I'm not sure if this solution is good for cross-platform communication.
Apart of Mac-related stuff and high-level solutions (I believe keywords "network service discovery" will bring you to them), there are a couple of things that will work for a local network:
I Have a server that clients should report to. Some short hello-like UDP message and a timeout mechanism will be sufficient to keep a list of available clients in the network.
II Use IP or UDP multicast groups to notify others that a client has just connected to the network. Send a message to a multicast group and listen to this group to build a list of clients.
However, broadcasts and multicasts won't be transmitted through a router. So if your network is large enough only neighbouring clients will hear your notification. In order to overcome it,
III DHCP servers can be configured to provide custom data to clients via unassigned DHCP options. Large networks have usually such server. You probably can use it to send out a list of clients, but I'm not sure about this.

Fetch Device IP Addresses/MAC address of devices connected to a LAN

Currently I am wondering how I would go about implementing a fetch request to a local wireless network (router) to obtain all devices currently connected to a currently connected LAN....
So I've done some research and apparently 'nmap' is a terminal/commandprompt command that returns connected devices to a local wireless network, with some parameters that need to be inputted into the nmap command.
I found an iPhone app that does what I'm trying to do... https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CDYQFjAA&url=https%3A%2F%2Fitunes.apple.com%2Fus%2Fapp%2Fip-network-scanner-lite%2Fid335517828%3Fmt%3D8&ei=qhHfUbDpJ4GkigKClIHYCg&usg=AFQjCNFMDPn5H8TbDw54-zYDYJ9iezRXpA&sig2=QN42a5w-MgClO5BvBUoDGw
It scanns for devices on a currently connected WiFi network and displays all devices connected to such network... I am attempting to do the same but am stuck on where to start...
Anyone have any ideas? I am trying to do this for iOS..
I'm thinking you could do a broadcast ping, ala:
$ ping -b 192.168.0.255
using the Apple sample code for ping.
But I have not tried it.

Redirect telnet 23 to COM Port via WIFI

I bought an Bluetooth ELM327 to read codes out of my cars diagnostic ports
I connect to it via Bluetooth in windows and it makes a serial-over-bluetooth com port 4
which any application running on my windows will connect quite happily.
I then found a few apps for the iphone and android etc that connect to these ELM gadgets via WIFI and not Bluetooth (because for some reason you cannot pair to these devices of iphone)
Now obviously I can buy a WIFI enabled ELM327 - but it costs £130 and my Bluetooth one cost £15
So after reading about this a bit I found out that the WIFI enabled ones you connect up as ad-hoc network and the smartphone(iphone) app tenets in port 23 that relays normal serial commands.
So obviously in the WIFI enabled one there must be some processor that runs an nano-os with telnet and some rs-323 translators and not sure what else.
How, using Windows 7 will i be able to relay any incoming WIFI requests for Telnet port 23 to my COM 4 that is connected to my Bluetooth ELM327 ..
As this is surely all that is needed by the Smartphone app.
You dont have to connect using a Bluetooth library like suggested ... because you are already connected to the device and have COM4 exposed to you. SO all you have todo is use a telnet library and translate and handle the handshake then realy the infomation as serial data.
There's no feature built in to Windows (or any other platform I know of) for such a scenario.
It would be fairly straightforward however to write a program to listen on port 23 and open a bluetooth connection when connected to, and then forward the data received on each connection out onto the other.
For instance one could use my .NET library 32feet.NET (e.g. http://32feet.codeplex.com/wikipage?title=General%20Bluetooth%20Data%20Connections etc etc) along with TcpListener from the .NET framework class libraries.

Capturing network traffic while the application is running on iPhone and connected to xcode

Is there any way I can capture network traffic (using application like Ethereal, on Mac ) while the application is running on iPhone and connected to xcode
Thanks
Connect you mac using an ethernet cable. Share your network connection on the mac over your AirPort. Attach the iPhone to your Mac's ad-hoc network.
Run Wireshark or HTTPScoop on your mac and you will be able to see all traffic from the iPhone.
I'm no aware of any way to do this for the WAN connection though. I'd be surprised if it is possible.
To capture packets from your iPhone using Wireshark, you have to first get your device id for the phone from iTunes. Plug in your iPhone via USB to your Mac...then open iTunes and click the iPhone icon in top navbar.
You can't copy the UUID, so you have to write it down manually. After you have the UUID, you'll need to mount the device.
Open a terminal and type: rvictl -s <device-id>
I created an alias in ~/.bash_aliases as alias mntios='rvictl -s <device-id>' -- as long as you have the same phone your device UUID won't change, even if you re-install the OS.
Once you have the device mounted startup wireshark. brew install wireshark (see: http://brew.sh)
One of the network adaptors should be rvi0 -- this is the network interface for your iPhone.
Now you can capture packets -- double click it to start capturing.
If you want to filter for specific urls you can type a filter like: http.request.full_uri contains <string-in-url> to filter requests.
On your computer, run an HTTP debugging proxy like Charles (Mac) or Fiddler2 (Windows). In the phone's wi-fi settings, turn on the HTTP proxy, entering your computer's IP address and the port number of the proxy. Make the sure the proxy is configured to allow connections from your phone. (It may allow localhost-only by default.)