我遇到GCDAsyncSocket
的问题,要对应用程序界面进行端口扫描冻结。
这是代码:
GCDAsyncSocket *clientSocket = [[GCDAsyncSocket alloc] initWithDelegate:self
delegateQueue:dispatch_get_main_queue()];
NSString *scanHostIP;
NSError *error = nil;
for(int i=1; i<=254; i++) {
scanHostIP = [NSString stringWithFormat:@"192.168.1.%d", i];
[clientSocket connectToHost:scanHostIP onPort:1234 withTimeout:0.4 error:&error];
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.4]];
}
我希望你能帮助我,谢谢。