Re: Socket Blocking Question
Re: Socket Blocking Question
- Subject: Re: Socket Blocking Question
- From: Greg Guerin <email@hidden>
- Date: Wed, 20 Jan 2010 14:41:37 -0700
Carter R. Harrison wrote:
> The second way is to send a request and then let the NSInputStream
call a
> delegate method when the response data is available. The response
data is
> then pushed up through my protocol stack and finally up to the
higher level
> application code. The benefit to this method is that CPU usage is
minimal
> due to the fact that I'm no longer blocking, but the downside is
that the
> higher level application code is so much more difficult to write
because I
> have to write about a thousand methods to act as a callback for
each request
> in a series of requests.
Maybe structure it as a Finite State Machine:
http://en.wikipedia.org/wiki/Finite-state_machine
http://en.wikipedia.org/wiki/Event_driven_finite_state_machine
I have done FSM's using AsyncSocket (and AsyncUdpSocket) and they
worked great.
-- GG
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden