• 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
NSFileHandle question.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSFileHandle question.


  • Subject: NSFileHandle question.
  • From: John Draper <email@hidden>
  • Date: Tue, 29 Mar 2005 15:52:02 -0800

Hi,

I'm using the EDCommon socket framework, which is sub-classed from the NSFileHandle
class and used with neetwork sockets.


I'm working on the part of my application that wants a timeout when no data is
received within a certain period of time.


I know there are zillions of ways to do this, and I'm sure that no matter what way
I choose, it's always going to be a bad decision or NOT the Mac way of doing things,
so seek some advice on the best way of doing this.


So I was thinking of doing the following:

[mSocket waitForDataInBackgroundAndNotify]; <--- I would call this when waiting for data.
if (noAnswerTimeout == nil) {
noAnswerTimeout = [NSTimer scheduledTimerWithTimeInterval:timeoutperiod
target:self
selector:@selector(noAnswer:)
userInfo: nil
repeats:NO];
}


- (void)noAnswer:(id)receiver
{
   // Not sure if I want to terminate the Notification or not - ANY ADVICE

  // And I do what I have to do to deal with the timeout here

   // of course we have to do this to ditch our timer when done.
   [noAnswerTimeout invalidate];    // disable timer, and release it.
   noAnswerTimeout = nil;               // NUKE our reference of course

}

Anyway, this is ONE approach I'm considering. But due to the fact there is such weak
documentation available on the EDCommon framework, it don't describe how to deal
with NO responses coming back from the network... Nor is the NSFileHandle adept
in dealing with this.... The uncertainties are:


1) Do I have to do anything when I want to stop the "listen" thread spawned
when "waitForDataInBackgroundAndNotify" is called?


2) If so - what do I do.... and of course I just have NO CLUE what happens when
there isn't any data to wait for, nor can I find any info on how to deal with this.


And of course I have my OWN things to do, if no data arrives within a specified
period of time.


Any advice? Please be liberal and generous with Source code examples if you
care to help me out. I'm really new at this... I don't want all the GORY details,
I just want to know how it all works together... IE: names and functions of
Delegate callbacks and how to deal with them.... Starting and ending Notification
threads... etc.


Thanx
JD



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: changing NSMatrix cells attributes
  • Next by Date: Re: Up arrow in NSTextView
  • Previous by thread: changing NSMatrix cells attributes
  • Next by thread: Sharing preferences
  • Index(es):
    • Date
    • Thread