• 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: Qestions about CFHTTP: asynchronous communication mechanism
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Qestions about CFHTTP: asynchronous communication mechanism


  • Subject: Re: Qestions about CFHTTP: asynchronous communication mechanism
  • From: Quinn <email@hidden>
  • Date: Wed, 24 Nov 2004 13:10:13 +0000

Title: Re: Qestions about CFHTTP: asynchronous communication mech
At 15:41 +0800 24/11/04, Alex Guo wrote:
I'm totally a freshman on Macintosh programming.

Welcome to Macintosh.
I'd like to know whether or not CFHTTP has asynchronous communication mechanism like the function InternetSetStatusCallback in Windows programming, so that I can explicitly know the status while connecting to HttpServer.

I'm not familiar with the Windows API you're referring too (or many other Windows APIs, *sigh*), but I can explain what status callbacks are offered by CFHTTP.

A CFHTTPStream is layered on top of the CFStream base 'class'.  Each CFStream has a status value, of type CFStreamStatus (in <CoreFoundation/CFStream.h>).  You can get the current status of a stream using CFRead/WriteStreamGetStatus.  You can ask to be notified of status changes by installing the stream on your runloop.  This involves:

o calling CFRead/WriteStreamSetClient to specify your callback function and what events you're interested in; these events are defined by CFStreamEventType and include kCFStreamEventOpenCompleted, kCFStreamEventHasBytesAvailable, and kCFStreamEventCanAcceptBytes

o calling CFReadStreamScheduleWithRunLoop to install your stream on the runloop so that it can call your callback

My guess is that this is less fine-grained than you were looking for; can you tell us what sort of events you're interested in?

S+E
--
Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
Apple Developer Technical Support * Networking, Communications, 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

References: 
 >Qestions about CFHTTP: asynchronous communication mechanism (From: "Alex Guo" <email@hidden>)

  • Prev by Date: Question about CFHTTPMessageAppendBytes
  • Next by Date: Re: Question about CFHTTPMessageAppendBytes
  • Previous by thread: Qestions about CFHTTP: asynchronous communication mechanism
  • Next by thread: Question about CFHTTPMessageAppendBytes
  • Index(es):
    • Date
    • Thread