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 (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to