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 (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