socket over DO.
socket over DO.
- Subject: socket over DO.
- From: Anthony Duer <email@hidden>
- Date: Mon, 2 Sep 2002 17:57:33 -0700
I was looking over the examples Apple provides for SimpleThreads and
TrivialThreads and I had a question about multi-threading a socket:
If I set up a smallsockets object to constantly be listening for new
data on it's port, will I be able to call other methods in that object,
such as a closeConnection? Example:
-(oneway void)listenWith: (NSArray connection)
{
[mySocket connectToHost: [connection objectAtIndex: 0] port:
[connection objectAtIndex: 1]];
while([mySocket isConnected]
{
//listen here for new data
//if we get new data pass it back to the main thread for
display in the UI
//if no new data, sleep for 0.05 seconds
}
}
-(oneway void)close
{
[mySocket close];
}
So if listenWith is constantly running, will it lock me out of the
thread if I attempt to call close it?
~Anthony Duer
_______________________________________________
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.