Tag: ip address

iPhone SDK: How to check if IP entered by user is valid?

My iPhone application includes several http requests to a server. The server’s IP address can be entered by the user so you can use the app in combination with your own private server. Before making the requests I always check whether or not the IP address entered is valid and I do it like this: […]

Get host name From IP address iOS 10

I need to fetch host name from ip address. Am able to fetch ip, mac addresses of all devices connected to my devices network, but hostname always returns nil. i had tried below code snippets to retrieve hostname but it always returns nil in my network CODE SNIPPET 1 +(NSString *)getHostFromIPAddress:(NSString*)ipAddress { struct addrinfo *result […]

How to identify sender's ip address of a udp packet received on iOS device?

How to find out the sender‘s ip address of a udp packet that was received on a device running iOS 3.2 or higher? For example, if using Python on a computer, I’d use SocketServer.UDPServer which takes a subclass of SocketServer.BaseRequestHandler which defines the handle callback. When a packet arrives, the callback is called and the […]

How to validate an IP address with regular expression in Objective-C?

How to validate an IP address in Objective-C?

Accessing IP Address with NSHost

I am trying to get the IP Address using NSHost. With the NSHost object I can use the addresses method to access an array of objects one of which is the IP Address. I fear though that the IP Address may change position in the array from one machine to the other. Is there a […]

How to get Domain Name of ipAddress and ipAddress from Domain Name in objective-c

I am able to get the current ip address of my device/machine that I am using – by using this question’s answer. I have gone through this question. Java allows to get the IPAddress from a domain name. Is it possible in objective c ? How ? The second question is How to get the […]

Objective-C : How to fetch the router address?

I tried to fetch the router address this way. – (NSString *) routerIp { NSString *address = @”error”; struct ifaddrs *interfaces = NULL; struct ifaddrs *temp_addr = NULL; int success = 0; // retrieve the current interfaces – returns 0 on success success = getifaddrs(&interfaces); if (success == 0) { // Loop through linked list […]

how to get ip address of iphone programmatically

This question already has an answer here: iPhone/iPad/OSX: How to get my IP address programmatically? 9 answers

Reachability with IP address won't work.

After inputting the Rechability classes Apple provided. Also after inputting this, Reachability reachabilityWithAddress:(const struct sockaddr_in *)hostAddress. How should we input the IP address we want to check into this line? This is the part where i’m really lost at.

How can I get a real IP address from DNS query in Swift?

I want to get the IP dress (like 192.168.0.1 or 87.12.56.50) from DNS query in Swift. I tried 100 times with 100 diffrent methods … Nothing helped me, so I’ll have to ask for help (I hope there are alots of folk here ;)) This is my code so far: let host = CFHostCreateWithName(nil,”subdomain.of.stackoverflow.com”).takeUnretainedValue(); CFHostStartInfoResolution(host, […]