Re: does SCNetworkCheckReachabilityByName work? (solved)
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.