如何在iphone上使用可达性wifi示例显示wifi AP的名称

时间:2010-10-08 02:18:33

标签: iphone

我想显示我所连接的WIFI AP的信息,怎么做?

+ (Reachability*) reachabilityForLocalWiFi;
{//NSLog(@"cheking all addresss ");
    struct sockaddr_in localWifiAddress;

    bzero(&localWifiAddress, sizeof(localWifiAddress));
    localWifiAddress.sin_len = sizeof(localWifiAddress);
    localWifiAddress.sin_family = AF_INET;
    //NSLog(@"Destination%@",localWifiAddress.sin_len);

    // IN_LINKLOCALNETNUM is defined in <netinet/in.h> as 169.254.0.0
    localWifiAddress.sin_addr.s_addr = htonl(IN_LINKLOCALNETNUM);
    Reachability* retVal = [self reachabilityWithAddress: &localWifiAddress];

    if(retVal!= NULL)
    {
        retVal->localWiFiRef = YES;

        //printf("%i",localWifiAddress);
    }
    return retVal;
}

0 个答案:

没有答案