• 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
CFStream: Error handling problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CFStream: Error handling problem


  • Subject: CFStream: Error handling problem
  • From: Doug Brown <email@hidden>
  • Date: Tue, 10 Jun 2003 14:10:29 -0700

Hi everyone,

I think I've found a slight problem with how CFStream gives you error numbers.

I'm playing around and hoping to use CFStream as the base for my network-related app rather than the BSD socket APIs. I'm very interested in error handling - i.e., I need to know what the error was on connect if there was one (name lookup failed, connection refused, or what?)

Well, most of the error codes I'll be seeing are from the POSIX "domain" as the CFStream docs refer to it as. That means they are basically errno codes, which can be plugged into strerror() or can be used to find what's really going on.

Well, that's fine and dandy and it works great when a connection error occurred, or an error having to do with the sockets, but it doesn't work when there's an error while looking up a hostname. gethostbyname() and its buddies use a different error numbering variable, h_errno (see the man page for hstrerror). But CFStream is still reporting the error code as a POSIX error, so you'd expect to be plugging it into strerror() instead.

Shouldn't there be another error domain just for error numbers that are really h_errno codes, and not errno codes? Is there a way to work around this?

I'm using CFStreamCreatePairWithSocketToHost(). Is there a better way for me to be doing this? At any rate, I think that another error domain should be added for gethostbyname errors...

Thanks,

Doug
_______________________________________________
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.

  • Follow-Ups:
    • Re: CFStream: Error handling problem
      • From: Jeremy Wyld <email@hidden>
  • Prev by Date: Re: Caller ID
  • Next by Date: Re: CFStream: Error handling problem
  • Previous by thread: Re: killing a sleeping server thread?
  • Next by thread: Re: CFStream: Error handling problem
  • Index(es):
    • Date
    • Thread