• 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
[Q] efficient or good model for send/receive with streams scheduled in runloop?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Q] efficient or good model for send/receive with streams scheduled in runloop?


  • Subject: [Q] efficient or good model for send/receive with streams scheduled in runloop?
  • From: JongAm Park <email@hidden>
  • Date: Tue, 27 Jan 2009 08:33:07 -0800

Hello,

I would like to write a network program which is scheduled in runloop.

According to "Stream Programming Guide for Cocoa", there are two scheduling, one is polling, and the other is run-loop scheduling.
Because I don't want it to block things, the run-loop scheduling would be a nice an convenient way to go.
( Probably using thread with polling or signaling is more flexible. Actually it looks like that the run-loop scheduling is implemented with thread and signaling. )


With run-loop scheduling, it is very handy to send data to others only when there is space in a buffer, and receive only when there are data in a buffer. ( NSStreamEventHasSpaceAvailable and NSStreamEventHasBytesAvailable )

However, I have difficulty in making it to send data and receive ack from a server.
Sometimes, it receives some meaningful data about changed information from a server, if a client send a request to change some data.
But sometimes it also receives ack.
So, I would like to make it do next job after receiving an ack.
So, I embraced a send routine with a lock. But the whole client process is in dead-lock status, because it is not multi-threaded.
( a receive routine already locked. )


Under this situation, is there a good network programming model or pattern? How should I solve this issue?

Thank you.
JongAm Park

_______________________________________________

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


  • Follow-Ups:
    • Re: [Q] efficient or good model for send/receive with streams scheduled in runloop?
      • From: Shawn Erickson <email@hidden>
  • Prev by Date: Re: Context Menu in NSBrowser
  • Next by Date: Re: Not Resolving Aliases
  • Previous by thread: Re: IntefaceBuilder IPhone TableView Size Question
  • Next by thread: Re: [Q] efficient or good model for send/receive with streams scheduled in runloop?
  • Index(es):
    • Date
    • Thread