• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
SCNetworkCheckReachabilityByName() behaves differently on PPC & Intel Macs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SCNetworkCheckReachabilityByName() behaves differently on PPC & Intel Macs


  • Subject: SCNetworkCheckReachabilityByName() behaves differently on PPC & Intel Macs
  • From: Alan Staniforth <email@hidden>
  • Date: Wed, 9 Sep 2009 20:23:28 +0100

Not a request for help, but this caused some hard to track down problems so I thought I'd post this and maybe save someone else some trouble in the future.

When SCNetworkCheckReachabilityByName() is called on PPC and Intel based Macs, under certain conditions different results are obtained for the same call.

Steps to Reproduce:
1. Build PPC and Intel versions of the following code:

    #import <SystemConfiguration/SystemConfiguration.h>

    BOOL result;
    SCNetworkConnectionFlags flags;
    const char *testHost1 = "homepage.mac.com";
    const char *testHost2 = "http://homepage.mac.com/kcall/";;

    result = SCNetworkCheckReachabilityByName(testHost1, &flags);
    NSLog(@"\t Test 1: 'result' is: %d; 'flags' is: %d\n", result, flags);

    result = SCNetworkCheckReachabilityByName(testHost2, &flags);
    NSLog(@"\t Test 2: 'result' is: %d; 'flags' is: %d\n", result, flags);

2.  Run the code on:
        1] PPC Mac
        2] Intel Mac
        3] PPC Code on an Intel Mac under Rosetta
    (ensuring that each test machine has an active internet connection.)

Results:
The PPC machine will output:
    Test 1: 'result' is: 1; 'flags' is: 2
    Test 2: 'result' is: 1; 'flags' is: 2

The Intel machine and PPC code under Rosetta on the Intel machine will output:
    Test 1: 'result' is: 1; 'flags' is: 2
    Test 2: 'result' is: 1; 'flags' is: 0

I see it consistently under several version of 10.5.x. Same behaviour under Snow Leopard (although when built on SL you get deprecation warnings for SCNetworkCheckReachabilityByName(). I haven't been able test on 10.4.

The docs for SCNetworkCheckReachabilityByName() specify the 'nodename' parameter as being a hostname not a URL so arguably it's just sugar that URLs happen to work with PPC library code. However, on the Intel Macs except sure in the URL case 'result' value should be NO as it is actually saying it can't determine reachability as you haven't passed a proper host name.

Filed on Radar/OpenRadar rdar://7182937

Hope this helps somebody, some day

-Alan.
--
Alan Staniforth                     **                  email@hidden
"Meum est propositum/In taberna mori,/Ut sint vina proxima/Morientis ori."
       -- Anon.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Re: accept() does not behave the same in 32 and 64-bit on 10.6 (From: Steve Modica <email@hidden>)
 >Re: accept() does not behave the same in 32 and 64-bit on 10.6 (From: Quinn <email@hidden>)

  • Prev by Date: Re: accept() does not behave the same in 32 and 64-bit on 10.6
  • Next by Date: UDP Broadcast fails
  • Previous by thread: Re: accept() does not behave the same in 32 and 64-bit on 10.6
  • Next by thread: UDP Broadcast fails
  • Index(es):
    • Date
    • Thread