Hi All.

I'm using CFNetwork APIs to create a cancellable web operation using the 
synchronous, non-blocking APIs like so:

 do {
     bytesRead = 0;
     if ( CFReadStreamHasBytesAvailable(inStream) ) {
         bytesRead = CFReadStreamRead(inStream, buffer, sizeof(buffer));
         if ( bytesRead > 0 ) {
             [data appendBytes:buffer length:bytesRead];
         } else if ( bytesRead < 0 ) {
             error = (NSError *)CFReadStreamCopyError(inStream);
             self.error = error;
             [error release];
             [self sendFailureCallback];
             return;
         }
     } else {
         [NSThread sleepForTimeInterval:0.1];
     }
     if ( bytesRead == 0 ) {
         streamStatus = CFReadStreamGetStatus(inStream);
         if ( streamStatus == kCFStreamStatusAtEnd ) {
             break;
         }
     }
 } while ( ![self isCancelled] );

This is fine once you've gotten to the point of pulling the response, but I 
would like the operation to also be cancellable if I'm pushing a lot of data in 
the request. There isn't a good example of this with the CFNetwork framework 
documentation. Does anyone have an example of doing the request-response where 
you're fully in control of cancelling the operation?

Thanks!

-Kenny

_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to