multithreaded vs ...?
multithreaded vs ...?
- Subject: multithreaded vs ...?
- From: Jason Kuri <email@hidden>
- Date: Mon, 18 Feb 2002 01:32:31 -0600
Hello,
I'm developing a cocoa framework to interface with a server using a
network messaging protocol (tcp based, variable-length records). The
concept is to provide a connection object which an app can use to handle
all communications with the server. (Basically dealing with the
connection process and complexities of packet arrival and decoding,
encoding, etc.)
My question is, given that the object will have to deal with packets
arriving at random times and that they will need to be dealt with
relatively quickly, what is the best way to incorporate my
network-processing into the applications event-loop?
If I were writing this in C, I would either create a separate thread for
handling network activity, or use nonblocking io and a select() loop
with callback functions. I think I have a reasonable understanding of
NSApplication and multi-threading in cocoa. Based on what I've read, I
have come to the conclusion that the best way to handle this is to
require that my connection-object operate in it's own thread... but as
I am relatively new to cocoa programming, I'd like to get a second
opinion. Is there a better way to handle this? I'm concerned that
forcing it into it's own thread will make using the framework overly
complicated.
Does anyone have any advice or pointers they could share? I'm guessing
my question has a fairly straightforward answer, but I'm relatively new
to Cocoa programming (though I've been programming Unix-C for years),
and I would really appreciate any pointers anyone can provide.
Thanks,
Jay Kuri
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.