Verify if a specific port and address are enable (Reachability) in swift 3 - swift

I am trying to know if a specific address and port are enable and reachability before to start to get data. Unfortunately I found a lot of examples but only verify if Wifi is enable. I need an answer in Swift 3 with port and address, not only and address. Any idea ? Thanks in advance.

Related

check internet connectivity in tizen

I am trying to find out what is the best way check internet connectivity in tizen. Although there is a connection manager I can think of a scenerio where it would not work. Suppose the device is connected to wifi but wifi is not connected to internet. What is the best best way to resolve this issue? I am thinking of using getaddrinfo? But would not that resolve to IP using cached value. Then should I connect to a known website (e.g. google although some country might block it)?
You can hit an address and check for response for certain time of interval. If there is no response for say 2 min or so then you can show message to user that there is some problem with Internet connection.

Is it possible to get the SSID & MAC Address of Currently connected WiFi Network in an App

I am looking for a way to get both the MAC Adress and the SSID of the currently connected WiFi Network in my project. I have used Tony Million's Reachability to decide when the user is on a WiFi network or not and was testing Kenial's NICInfo only to find out that it only provides the iPhone's WiFi MAC Address. Although both projects helped greatly in there own way, they do not get the job done.
I am wondering if there is a public API (for certain Apple App Approval) or some back door to achieve this.
This involves a few different things:
Getting SSID - This is independent of the MAC address issue. For this, check this SO answer: iPhone get SSID without private library. I don't know what the etiquette is regarding re-posting code from other answers so I'll just link.
Getting MAC address - since the majority of networking operates at Layer 3 (which is called, who would have guessed, the Network Layer - http://en.wikipedia.org/wiki/OSI_model) and the MAC address is at Layer 2 (the Data Link layer) you'll first need to get the IP address of the gateway of the WiFi interface. Just a side note - the question should be phrased as 'How do I get the SSID of the currently connected WiFi network and the MAC address of the WiFi router/gateway'. Anywho, to get the gateway address, see this SO answer: How to get the WIFI gateway address on the iPhone?
Once you have that, you need to convert it to a MAC address using ARP (Address Resolution Protocol, which is the protocol that all networks use to convert IP addresses to MAC addresses). Network interfaces don't communicate via IP, they communicate via MAC, so this actually happens everywhere, all the time. It's actually pretty easy to access the ARP table on a PC/Mac. For iOS, I found this SO answer to convert an IP address to a MAC address: Getting ARP table on iPhone/iPad

iPhone UPNP Port mapping

Has anyone found a method to port forward an internal IP with iOS.
Note: Have tried CyberLink, Platinum, MiniUPNP, upnpx, TCMPortMapper with out success.
Take a look at DNSServiceNATPortMappingCreate() in usr/include/dns_sd.h of the iOS SDK.

How to check iPhone network type GSM or CDMA

In my application I need to check network type GSM or CDMA (for Verizon). I found CTCarrier class which contains property mobileNetworkCode, but I don't wanna hardcode value for each providers. Are there other ways to check it?
Please help.
You could get that through the Model#, but then again, you have to hardcode a list of Model# and compare them.
Maybe you could do that by checking the IP Address of the iPhone if it is wireless connected. If once detected it would´t change unless you change the SIM ;-)
At http://www.tcpiputils.com/browse/ip-address/192.76.85.245 you get information on verizon IP space

Question about using Bonjour or other methods to secure a connection with a non computer device

So I have a project I am working on, and I would basically like to send a basic yes/no command from the iPhone to a wifi enabled device that is also connectedto the network on the same router. This other device is not a computer, so I am wondering if I can still use Bonjour? In order to use Bonjour, do both of the communicating devices need to have some sort of a script installed and running that is allowing them to communicate? What would be the best way to connect to this device that is connected to the router, and then to send information/commands to it? I could really use some help finding a direction, because once I identify which tools I need to use, I can research them out and get it done (maybe). If anyone could offer any insight/suggestions whatsoever, it would be greatly appreciated!! Thanks in advance
Bonjour is a local service discovery protocol based on multicast DNS. Even if your device supports it you still need some piece of software on the device to listen to your commands.