Comments (2)
Also, maybe this will help
#include <arpa/inet.h>
#include <resolv.h>
res_state res = malloc(sizeof(struct __res_state));
int result = res_ninit(res);
if(result == 0){
// pass
int nscount = 0;
union res_sockaddr_union u[MAXNS];
nscount = res_getservers(res, u, MAXNS);
NSLog(@"nscount = %d", nscount);
int i;
for(i = 0; i < nscount; i++){
if(u[i].sin.sin_family == PF_INET){
NSLog(@"IPv4");
char straddr[INET_ADDRSTRLEN];
inet_ntop(PF_INET, &u[i].sin.sin_addr, straddr, sizeof(straddr));
NSString *s = [NSString stringWithCString:straddr encoding:NSASCIIStringEncoding];
NSLog(@"%@", s);
}
if(u[i].sin6.sin6_family == PF_INET6){
NSLog(@"IPv6");
//struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)&u[i].sin6;
char straddr[INET6_ADDRSTRLEN];
inet_ntop(PF_INET6, &u[i].sin6.sin6_addr, straddr, sizeof(straddr));
NSString *s = [NSString stringWithCString:straddr encoding:NSASCIIStringEncoding];
NSLog(@"%@", s);
}
}
}else{
// fail
}
from mmlanscan.
Hi,
MMLanScan doesn't support IPV6. It's entirely different concept and that's why you get an IP 169.* It cant get it's subnet and its assumes that is /1, that's why is crashing. I should add a case to not scan IPv6 networks. If you implement it feel free to send me a pull request
from mmlanscan.
Related Issues (20)
- What is the function to scan all the associated IP ? HOT 2
- Library without MAC and brand name?
- the efficiency of using ping too slow HOT 1
- iOS 12获取不到了 HOT 1
- Scanning is too slow HOT 1
- get port and detect camera
- Support for Mac OSX? HOT 1
- Non connected device Data. HOT 2
- App crashing after ping HOT 14
- How can I get the Max address?
- lanScanner.start() freezes app when wifi is not connected to interner. HOT 2
- Scan devices in order?
- Duplicates HOT 4
- List devices connected to iPhone's hotspot
- [] nehelper sent invalid result code [1] for Wi-Fi information request
- Hostname issue
- Crash when scanning on non-main thread
- How to get device type like router, laptop or mobile? HOT 2
- The operation couldn’t be completed. Operation not permitted HOT 2
- Mac empty when run with real device iOS 15. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mmlanscan.