• 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
socket over DO.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: Re: [OT] FSpDirCreate returning fnfErr on X, but not 9.
  • Next by Date: Re(2): [OT] FSpDirCreate returning fnfErr on X, but not 9.
  • Previous by thread: Re: Variable Sized Subview
  • Next by thread: Weird Log message (maybe NSView related?)
  • Index(es):
    • Date
    • Thread