• 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: CFNetwork, Run Loops, and Tools
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CFNetwork, Run Loops, and Tools


  • Subject: Re: CFNetwork, Run Loops, and Tools
  • From: "Duane Murphy" <email@hidden>
  • Date: Fri, 3 Feb 2006 15:18:41 -0800

I trimmed down the code to just have my networking interface and the run loop.

Sure enough, if I use CFRunLoopRun() it works dandy. If I use
CFRunLoopRunInMode() it doesn't work.

Here are the relevant lines:

		SInt32 run_loop_reason
			= CFRunLoopRunInMode( kCFRunLoopCommonModes, 0.5, false );
    // true or false for returning doesn't affect the results

and

	CFReadStreamScheduleWithRunLoop(
		stream, CFRunLoopGetCurrent(), kCFRunLoopCommonModes );

There are no other threads. The second call is on the same call stack as
the first so it's the same run loop.

So what could be the problem?

 ...Duane

--- At Fri, 3 Feb 2006 14:47:29 -0800, Becky Willrich wrote:

>It's hard to tell without seeing your code, but it does sound like
>something run loop related has gone wrong.  What mode are you running
>the run loop in?  Does it match the mode you scheduled the stream
>in?  I'd double-check your arguments to
>CFReadStreamScheduleWithRunLoop and CFRunLoopRunInMode; that's the
>best I can suggest.
>
>Good luck,
>REW
>
>On Feb 3, 2006, at 2:31 PM, Duane Murphy wrote:
>
>> Hello Fellow Network Programmers,
>>
>> I'm writing a tool (ie command line program), that uses CFNetwork, in
>> particular CFHTTPMessage and CFReadStream (in order to do some HTTP
>> transactions).
>>
>> I'm having trouble in that everything seems to get built OK (using
>> CFNetworkHTTPDownload as a model), but there is no network traffic.
>> Nothing comes out at all.
>>
>> I am using CFReadStreamScheduleWithRunLoop(). My context retain()
>> function is being called, so there's something there.
>> CFReadStreamOpen()
>> returns true, but I don't see any traffic (with tcpdump), and the call
>> back function is never called, and the context release function is
>> never
>> called.
>>
>> I'm wondering if there's something in the run loop that I need to
>> setup?
>>
>> I am calling CFRunLoopRunInMode() in a while loop. Interestingly it
>> always returns kCFRunLoopRunFinished, which means there's no
>> sources on
>> the run loop.
>>
>> I setup all the CFNetworking code before calling CFRunLoopRunInMode().
>>
>> What am I missing?

 ...Duane

 _______________________________________________
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

  • Follow-Ups:
    • Re: CFNetwork, Run Loops, and Tools
      • From: "Duane Murphy" <email@hidden>
References: 
 >CFNetwork, Run Loops, and Tools (From: "Duane Murphy" <email@hidden>)
 >Re: CFNetwork, Run Loops, and Tools (From: Becky Willrich <email@hidden>)

  • Prev by Date: Re: CFNetwork, Run Loops, and Tools
  • Next by Date: Re: CFNetwork, Run Loops, and Tools
  • Previous by thread: Re: CFNetwork, Run Loops, and Tools
  • Next by thread: Re: CFNetwork, Run Loops, and Tools
  • Index(es):
    • Date
    • Thread