Re: Questions related to CFHostSetClient, CFStreamError, deprecation and error code
Re: Questions related to CFHostSetClient, CFStreamError, deprecation and error code
- Subject: Re: Questions related to CFHostSetClient, CFStreamError, deprecation and error code
- From: "Quinn \"The Eskimo!\"" <email@hidden>
- Date: Mon, 02 Jul 2012 14:18:57 +0100
On 2 Jul 2012, at 12:16, Stéphane Sudre wrote:
> Question #1:
>
> According to some headers directly accessing the domain and error values of CFStreamError is deprecated and one should use one of the provided CFRead/WriteStreamCopyError functions.
Yeah, that comment only applies to CF/NSStream, where there's new API for getting a CF/NSError. For places that use CFStreamError and don't provide an equivalent (CFHost is one, NSNetService is another), you must continue to use the old school errors.
I'd appreciate you filing a bug against CFHost to get a better error reporting mechanism. CFStreamError is un-fun.
<http://developer.apple.com/bugreporter/>
> Question #2:
>
> Where are the error codes defined for the CFHostRef API?
There are two error domains that come from CFStream, kCFStreamErrorDomainPOSIX and kCFStreamErrorDomainMacOSStatus. CFNetwork defines a bunch of others.
$ grep -r -i "CFN_EXPORT const SInt32" .
./CFFTPStream.h:CFN_EXPORT const SInt32 kCFStreamErrorDomainFTP __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0);
./CFHost.h:CFN_EXPORT const SInt32 kCFStreamErrorDomainNetDB __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0);
./CFHost.h:CFN_EXPORT const SInt32 kCFStreamErrorDomainSystemConfiguration __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0);
./CFHTTPStream.h:CFN_EXPORT const SInt32 kCFStreamErrorDomainHTTP __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0);
./CFNetServices.h:CFN_EXPORT const SInt32 kCFStreamErrorDomainMach __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0);
./CFNetServices.h:CFN_EXPORT const SInt32 kCFStreamErrorDomainNetServices __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0);
In most cases the place where the error is defined also defines the error codes.
The domain most relevant to CFHost is kCFStreamErrorDomainNetDB. These error codes come from <sys/netdb.h>.
Share and Enjoy
--
Quinn "The Eskimo!" <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
_______________________________________________
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