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.
Related
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.
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)
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.
I am implementing a client (IOS device) and Server. I wish to keep the payload of request/responses to a minimum so plan to implement a custom TCP based service. My only concern is if I can rely on the port I use being always open through 3G etc. There must be other apps that use non standard ports and TCPon IOS?
If you can, you might use Port 80/443(SSL) for your custom TCP server. You only have to ensure that your have a free IP on your Server to bind your custom server-application to port 80.
If it's not HTTP(D) behind port 80/443(SSL), thats not a problem!
When using other port you may run into problems with blocked traffic in firewall rules.
But that's the standard case. Like a VOIP/SIP iOS App needs the SIP Port 5090. So if you are try to make a call within your University WiFi where only some Ports except 5090 are supported, the app won't run/connect.
So. You should make it like Viber or WhatsApp Messenger does. Use Port 80/443(SSL) and try to get the max possible connects trough possible firewalls.
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 ;)