Service discovery using dns-sd - wifi

I have a device which is configured in station mode. Device is connected to a smart phone over hotspot provided by smartphone. Device needs to search for a service published by an application on smartphone say _abc._tcp.
I am using the command dns-sd -B _abc._tcp but no output.
Please guide me what I may be missing.
The application publishes the service. I verified it using Bonjour application on android.
Also please clarify
Is it possible to discover the services while in station mode.
While searching for services is it necessary to provide complete service name. If not how we can discover all the services published on the smart phone
Can firewall settings on device affect for service discovery?
How can we achieve the same in C++. Any libraries which can help in discovering.
Thanks is advance.

Is it possible to discover the services while in station mode.
see station mode
While searching for services is it necessary to provide complete
service name.
yes
If not how we can discover all the services published on
the smart phone
Service discovery is meant to be used to discover a severice you're looking for like a printer or a webpage.
One solution you might use is to find all services and query for each instance of the service. Each instance has a name and an ip which you can compare to the phone's ip. Well this is quite ugly I think.
Can firewall settings on device affect for service discovery?
Yes
How can we achieve the same in C++. Any libraries which can help in
discovering.
There are libs in almost every language... search for c++ service discovery in your favourite search engine and you will find plenty (or another so-thread with links to one or more)

Codewing has already provided answers.
To add to above answers.
Can firewall settings on device affect for service discovery?
Yes. Also service discovery can happen on multiple interfaces (wlan0, eth0...).
These interfaces also affect service discovery. To check on this dns configuration file can be checked. In my case interface wlan was disabled in configuration file so I was unable to discover services.

Related

How can I scan for all IPs of devices connected to the network using Apple's Network Framework?

I want to scan for any device found in the network my device is currently connected to. I want to find their IP address and possibly more information so I can present the user a list of all devices in the network providing as much details as possible.
I have found example using getifaddrs. They kind of work, but, I am unable to see all of the devices I can see with an app like IP Scanner on the Mac app store.
In the process I have learned that the new Framework Apple is pushing is the Network framework.
I haven't been able to find many examples on how to possibly build an IP scanner using the Network framework. I think I may be able to achieve that using NWBrowser, but I am not sure as that seems to be strictly a Bonjour play.
Does anyone have example I could follow to learn how to build an IP scanner using the new Apple Network Framework?

Starter code to monitor DHCP, m-DNS,DNS traffic in iOS

We are new to iOS apple development and iOS network extension but we do have general application development experience. We are wondering if there is a starter code available which we could utilize for our project.
We are looking for a virtual network interface in iOS so could monitor network traffic. Our goal is to monitor DHCP broadcast,m-DNS, DNS traffic.
If there are other methods, we would love to know.
There are different ways you can intercept DNS traffic in NE. However, if you are only interested in capturing DNS traffic, DNS Proxy Provider would your best option. Although, DNS Proxy Provider has limitation that it is only supported on managed devices.
Few discussions that would help:
https://developer.apple.com/forums/thread/81103?answerId=246229022
https://developer.apple.com/forums/thread/665480
How to use NEDNSProxyProvider in iOS 11
Few samples on GitHub:
https://github.com/pusateri/DNS-TLS
https://github.com/GroupeMINASTE/FMobile-iOS
You can search for NEDNSProxyProvider in developer forums to find quite a few discussions about it. This discussion also provides some good details. Also, this one.
You may also use Packet Tunnel Provider with match domains or empty match domains and full tunnel. This will allow you to support NE without MDM.
Few examples of Packet Tunnel Providers:
https://github.com/douxinchun/RabbitVpnDemo
https://github.com/OperatorFoundation/PacketTunnelExample
https://github.com/davlxd/NEPacketTunnelVPNDemo

.local domain and iOS/OSX

Hello I'm working with an hardware team to a really nice device that we can connect through with an iOS application. Currently we are using an ip address to perform calls on this device and it is working perfectly. Since we read about the new ATS specifics by Apple, we are trying to move the connection to a .local domain instead of using an IP address, so that we can configure domains exceptions in the App Transport Security Settings. We are experiencing a lot of problems trying to connect to the .local domains from the App... it seems that the DNS is never resolved. Are there any known bug related to .local domain? I seen some very old bugs... but nothing related to iOS 10/9.
Note: Currently to connect to the device we have to put the device in Access Point mode and from iOS settings we choose it as "wi-fi" router.
You're looking for Zero configuration networking, specifically DNS Service Discovery, an industry standard that Apple markets as Bonjour. That's what allows a device to list its services for DNS discovery through the .local top-level domain.
"Publication: An Example" in Apple's Bonjour guide is a good place to start for understanding what you'd need to do to implement this as a hardware vendor.

Delphi: Is there any way to use App Tethering with internet connection?

I'm using Embarcadero RAD Studio Delphi XE8.
Multi-Device Application app tethering components are designed for traditional WiFi and Bluetooth coupling. Does it support also Internet connections?
I would like to try to make small p2p app. I'm using App tethering via Wifi but I would like to connect App tethering via internet connection.
how to do that ?
Taken from the documentation
Connecting to Applications Outside Your Subnet
By default, both AutoConnect and DiscoverManagers perform the
discovery on the subnet of the local area network (LAN) where the
device running your application is. However, you can use their
optional parameter Target to override this behavior, and specify an IP
address or subnet: To specify an IP address to search for remote
managers, specify that IP address as the Target. To specify a subnet
of IP addresses, specify an IP address with a 0 as its fourth number.
For example, if you specify "192.168.4.0" as the Target, your manager
searches the 192.168.4.x subnet for remote managers. Note: You can not
specify wider subnets. For example, "192.168.0.0" is not supported.
In other words you need to use the IP address as the optional ATarget parameter of the mentioned calls. The differences to local tethering are minor, which I guess is why there are not many examples.
See the Embarcadero web site for more details
Try VPN connect two device. If your 2 device is same vpn (For ex: Softether , Openvpn). you can discover other device around the world. (Dont forget enable vpn server settings to discover other devices options)

Accessing remotely my web service

I have implemented a web service on my mac and I am able to access its functionalities through the url "http://localhost:8080/ServiceApp-war/resources/".
As I got satisfying results that I could see in the iPhone simulator in Xcode, I decided to connect my iPhone and test on it. But for this to work I think I need to change the "localhost" in my URL to the IP address of my mac.
I tried to replace it with my public IP address and I got a "could not connect to the server" error on my console. I also tried to replace "localhost" with the IP address I found in System Preferences-->Network-->Wi-Fi and I could see that it was working on the simulator but still nothing when I connect my iPhone and run the application on it.
Please provide a solution for accessing my web service remotely.
Thank you.
Create hotspot from your mac, connect to it with your iPhone and try again.
<lame solution>
Try some service for temporary domain, it will make your computer accessible from anywhere.
How do you "connect" your iPhone? USB connection does not create a network. Well, it does create if you turn on Personal Hotspot on your iPhone (maybe in some other cases, dunno). But the most simple way is to connect Mac and iPhone to the same WiFi network.
Once connected, you can use any of "ping" apps available on App Store. Just look for "ping" (some kind of "network reachability test" or so). You can check if your Mac is really reachable on the network.
If it's not reachable, check your network settings on both devices: do they belong to the same subnet, do they use the same gateway, etc.
If your Mac is reachable with ping, then you should deal with your web service. I setup the web server (which is already distributed within OS X): it already has all the settings to allow other devices to connect. But your web service may require some additional setup. It's two basic things: it should bind to your IP address (please check http://YOUR.IP:8080/ServiceApp-war/resources/ from your Mac!) and second, accept incoming connections from other agents, you should find it somewhere in its settings.
Ngrok was the perfect solution I was looking for.
https://ngrok.com
You could also try finch, which is similar to ngrok. It has a nice friendly GUI. https://meetfinch.com

Resources