• 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
NSTimer problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTimer problem


  • Subject: NSTimer problem
  • From: John Draper <email@hidden>
  • Date: Tue, 26 Apr 2005 19:25:50 -0700

Hi,

I'm trying to make repeated attempts to send UDP packets to a remote host.
I'm using an NSTimer for this purpose.

This is the method I'm using to start the multiple sends.  I want to send
a try every 100 ms.   IE:  0.1 secs....

- (void)startSending
{
   // Create instance of the timer.
   myTimer = [[NSTimer scheduledTimerWithTimeInterval:0.1
                                              target:self
                                            selector:@selector(trySynch:)
                                            userInfo:nil
                                             repeats:YES] retain];
   sending = YES;
}

// This is my callback the timer is supposed to call. But it's not getting called....
- (void)trySynch:(NSTimer *)Incoming_Timer
{
if (num_tries <= 0) {
NSLog(@"Stopped sending");
[myTimer invalidate];
myTimer = nil;
// now we have to post a notification, telling the
// delegate that we timed out.
[myController timedOut:sendData];
} else {
NSLog(@"Try Sending %d", num_tries);
[mySocket writeDataTo:myIP
port:myPort
theData:sendData];
// make sure we wait for return.
[mySocket waitForDataInBackgroundAndNotify];
num_tries--;
}
}
When I put a breakpoint at start of "trySynch", I get this...
asm _objc_trap 0x9083be80


0x9083be80  <+0000>  trap
0x9083be84  <+0004>  blr
0x9083be88  <+0008>  .long 0x0
0x9083be8c  <+0012>  .long 0x0
0x9083be90  <+0016>  .long 0x0
0x9083be94  <+0020>  .long 0x0
0x9083be98  <+0024>  .long 0x0
0x9083be9c  <+0028>  .long 0x0

Obviously it appears I'm de-allocating some object before I use it. I have NO CLUE how
to find it. Can anyone give me some pointers on how I can find this problem?


Is my Timer code correct?  Am I using it right?

Is there anyway I can get a list of allocated objects, kinda like a "heap dump"?
in OS_X?


What debugger command can I use to list any de-allocated objects using "gdb" or
the source level debugger?


John
_______________________________________________
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


  • Follow-Ups:
    • Re: NSTimer problem
      • From: Shawn Erickson <email@hidden>
  • Prev by Date: Accepting All Drops
  • Next by Date: Weird message
  • Previous by thread: Re: Accepting All Drops
  • Next by thread: Re: NSTimer problem
  • Index(es):
    • Date
    • Thread