iOS Bonjour Over the Internet - ios

I know that iOS's Bonjour implementation (NSNetService, NSNetServiceBrowser) work out of the box on local networks.
The documentation says it is possible to set up a Bonjour DNS server to allow connecting users over the internet, so my questions are:
What is the Bonjour DNS server interface? is there a sample I can start from?
Does the DNS Server responsible for the initial hand-shaking\connection of the peers and the rest (send\rec data) will be directly between the peers?
Does the DNS Server provide a NAT hole-punching mechanism?
Thanks!

Bonjour local service discoveryis based on "multicast DNS". whenever some client wants to find out anything about the network or services on the network it uses the multicast address 224.0.0.251, meaning only clients within that multicast group can use bonjour together.
the 244.0.0/24 IP-Address space is defined as "Local Network Control Block" by RFC5771 and will not be forwarded out of your local network.
BUT really, Bonjour is just a DNS-based method - you can tell NSServiceBrowser to search in a non-local domain, which just requires the DNS server to respond to specific requests (as described in Manually Adding DNS-SD Service Discovery Records to an Existing Name Server)
This allows service discovery over the internet and even service registration if you get DNS Update working (Setting up a Bonjour Name Server), but nothing more - you have to care about hole-punching yourself.
So get yourself a BIND-server and start trying ;)

Related

Can grpc communicate with mac address insted of ip

Currently my program use the IP of the other device in order to communicate over grpc.
Unfortunately the IP is changing all the time and I cannot continue the connection between the devices without updating it manually.
The connection between the devices is only on LAN and should blocked access from WAN.
Locking the IP of the device in the rowter settings is not an option this time.
Does grpc have a way to communicate over LAN (inside my network) using identification number or mac address that does not change over time?.
Related questions I found:
grpc: Identify clients from same IP address
Reason for both a MAC and an IP address
In order to locate a machine based on its MAC address, you are talking about implementing ARP. This is something that is not supported in dart nor am I sure it would be advisable to go this route anyway. If setting a DHCP reservation on your router is not an option, are you able to skip DHCP and set a static IP on the receiving machine?
You could look into dynamic DNS which your router may support, or you may need to set up separately, but that will also require a static IP (for your DDNS server). If your machines can connect to the internet there are many DDNS services you can sign up for, but it sounds like that is not the case.

Connect to a peer based on IP address and port

I've got an app that supports Bonjour and manually connecting to an IP (all within the same local network). I'm now looking at whether I can use MPC instead and while it obviously would be able to replace Bonjour, I haven't seen anything that allows me to replace the functionality around manually connecting to the IP. For context, my app runs in networks that have multicast disabled which is when users fall back to manually entering the IP address.
I could have the receiving app host a webserver and send a request there. Could I create a Peer based on the ip:port combination? That would allow me to make use of MPC for the MCSession aspect.
Is it possible to set up a Multipeer Connection based on an ip:port rather than having it automatically discovered via multicast?
I'll go with a solution based on NWConnection which uses NWEndpoint and can be created with both IP:port and a Bonjour-established service.
If I would've had access to the full Network.framework then I could've used that for both discovery & communication but due to SDK constraints I'll be using MultipeerConnectivity for the discovery aspect instead. By providing the device its IP & port when broadcasting the Bonjour service, another device can discover it automatically and then use the extra info to create an IP:port-based NWConnection.

Can I connect from an Android device to my router from anywhere (outside of LAN - not hosted database)?

TLDR: i'd like to connect from a mobile phone app to a database on my RPI from anywhere on the world. Is it possible without hosting an URL or udpating the IPs in the app and being it free?
Longer version: if I set a static local IP to my RPI, can I somehow connect to the router from anywhere on earth via the internet? I'm making an app for employees to log their work around our country and I would give them out the .apk to install, so I'd like to make it always working (even if router restarts, etc). Is it possible via code (C#) or is there a free service that could allow me to do it? (service to set a global static ipv6 to RPI?)
You can use https://ngrok.com/ or https://localtunnel.github.io/www/ (The default server for this is down these days) on your raspberry pi to receive a URL for a web service hosted on it.
If your router gets a public IP from your ISP, you can configure port forwarding on it to your raspberry pi, such that it forwards all connections to router-ip:port -> raspberrypi-localip:port and use a dynamic dns service like http://www.duckdns.org/ to give a "domain name" for your router instead of using the IP.
There are a lot of ways to do this really, but i say look into ngrok or if possible, the dynamic dns approach.

Identifying WiFi clients connected to ESP8266

I'd like to know that a specific device (phone/tablet) has joined my WiFi network created by ESP8266 microcontroller. It shouldn't require any installed apps on that phone/tablet, if possible, to simplify the whole setup.
So I think I need to somehow identify connected clients, and MAC is not an option because it is subject to change randomly on, say, Apple devices.
Maybe it's possible to collect host names of connected clients?
I know that Windows and Ubuntu clients send their host names when getting IP from DHCP server (see here). Also, it's possible to find such information on, say, home Wi-Fi router admin web page (i.e. host names, their IPs and MACs).
I'm running DHCP server on ESP8266, but I haven't found any API that allows to get peer host name (i.e. reverse DNS). Does ESP8266 support getting such information?

How to access a network remotely without server or port forward

I am currently developing an application on iPad which connects to a client pc on the local network and delivers messages.
I installed a python application at the client after reading the following tutorial:
http://www.raywenderlich.com/3932/how-to-create-a-socket-based-iphone-app-and-server
It works fine for local connections.
The application opens a port for connection and my iPad application connects using the local IP of the client and the port.
What happens if I want to connect to a public IP?
I tried that and it doesn't work. I got the client's public IP from the following site:
http://www.whatismyip.com/
and I used the same python app to open a port.
I presume, that I have to open a port on my router and forward it to the client. But is there a way to do it without having to access settings of my router. I want to achieve instant access, so that the user would not have to worry about settings.
Just like Skype does, or multiplayer games, or other online services. My question is a little bit generic, not specific. Sorry for this. I hope it may help other people also.
Presumeably the machine you are trying to reach is behind a router/NAT device. In other words, it is not directly connected to the Internet.
The router is responsible for deciding what datagrams are allowed to move between the private and public networks, and where they should go.
Skype, games, and online services all initiate their connections from within the private network outward to a server on the public network. Outgoing network traffic triggers a temporary NAT (Network Address Translation) rule which allows datagrams returning from the destination to be routed back to the private host.
But other incoming traffic will be blocked unless you specifically set a rule in the router/NAT telling it where to send the data. How else would it know which address to forward the data to?
So there are only three ways you can communicate with a machine behind an NAT router:
It must contact you first.
Someone must configure the NAT/router to forward a public port to the private machine.
You both must contact a third machine which acts as an intermediary.
The only way to have full connectivity for a host is for it to have its own properly routed public IP address. Otherwise, the whole point of an NAT is to limit connectivity.

Resources