如何使用SimplePing ping多个主机?

时间:2011-06-27 02:18:06

标签: objective-c cocoa macos networking ping

我正在使用Apple的这个SimplePing示例代码:http://developer.apple.com/library/mac/#samplecode/SimplePing/Introduction/Intro.html ping局域网中的其他主机。 我正在使用这种方法:

+ (SimplePing *)simplePingWithHostAddress:(NSData *)hostAddress;

工作正常,但我想一次ping多个主机。我只是不知道该怎么做。

我有一个充满IP的NSArray(NSString)。有人可以举个例子吗?

THX!

2 个答案:

答案 0 :(得分:1)

答案 1 :(得分:0)

for (int i=0; i<[self.hostArray count]; i++) 
{
[SimplePing simplePingWithHostAddress:[hostArray objectAtIndex:i]]; 
}