• 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
Re: does SCNetworkCheckReachabilityByName work? (solved)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: does SCNetworkCheckReachabilityByName work? (solved)


  • Subject: Re: does SCNetworkCheckReachabilityByName work? (solved)
  • From: Chris Silverberg <email@hidden>
  • Date: Mon, 19 Aug 2002 18:55:51 -0700
  • Organization: Silverberg.Net

Hi Allan,

I figured out my problem. It's a compiler difference. I'm using
CodeWarrior and it all comes down to how enums are handled. SCNetwork.h
defines the following:

typedef enum {
kSCNetworkFlagsTransientConnection = 1<<0,
kSCNetworkFlagsReachable = 1<<1,
kSCNetworkFlagsConnectionRequired = 1<<2,
kSCNetworkFlagsConnectionAutomatic = 1<<3,
kSCNetworkFlagsInterventionRequired = 1<<4
} SCNetworkConnectionFlags;

The above typedef is unsafe because it is dependant on how a compiler
implements enum. Apparently GCC will treat enum as a UInt32. CodeWarrior
on the otherhand is going to treat it as something smaller, a UInt8 I
believe.

A safer way to define the above (and also consistent with most other MacOS
header files) is the following:

enum {
kSCNetworkFlagsTransientConnection = 1<<0,
kSCNetworkFlagsReachable = 1<<1,
kSCNetworkFlagsConnectionRequired = 1<<2,
kSCNetworkFlagsConnectionAutomatic = 1<<3,
kSCNetworkFlagsInterventionRequired = 1<<4
};
typedef UInt32 SCNetworkConnectionFlags;


Now I'm getting back the value I expect. :-)

I'll check if this is still the case in Jaguar headers... if it is I'll file
a Radar bug.

thanks,
Chris
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: does SCNetworkCheckReachabilityByName work? (From: Allan Nathanson <email@hidden>)

  • Prev by Date: Re: does SCNetworkCheckReachabilityByName work?
  • Next by Date: Re: does SCNetworkCheckReachabilityByName work?
  • Previous by thread: Re: does SCNetworkCheckReachabilityByName work?
  • Next by thread: Re: does SCNetworkCheckReachabilityByName work?
  • Index(es):
    • Date
    • Thread