Reach ReachWAdAddress not working

I am trying to determine if iphone can connect to my IP address using the following code

struct sockaddr_in server_address;   
server_address.sin_len = sizeof(server_address);
server_address.sin_family = AF_INET;
server_address.sin_port = htons(8888);
server_address.sin_addr.s_addr = inet_addr("1.2.3.4");
Reachability *r = [[Reachability reachabilityWithAddress:&server_address ] retain];
NetworkStatus internetStatus = [r currentReachabilityStatus];

But he always says that the status "Achievable" does not depend on what I give in the IP address. Am I doing something wrong? Why won't it work? Thank you for understanding.

+5
source share
1 answer

check this answer ( fooobar.com/questions/517835 / ... )

Link to SCNetworkReachability

The SCNetworkReachability programming interface allows you to use the application to determine the status of the current network configuration of the system and the reachability of the target host.

, , , . , .

0

All Articles