I'm trying to get the current upload and download bytes every X seconds from a netstat command. I'm using an NSTimer to launch a netstat process every time:
refreshData currently only calls startTask:
The first time the timer calls refreshData everything works. The second time I get this in the debugger:
Thanks for the help.
Code:
NSTimer *timer = [[NSTimer scheduledTimerWithTimeInterval: 5
target: uiHandler
selector: @selector(refreshData:)
userInfo: nil
repeats: YES] retain];
[timer fire];
Code:
- (void)startTask {
aTask = [[NSTask alloc] init];
pipe = [[NSPipe pipe] retain];
handle = [[pipe fileHandleForReading] retain];
[aTask setStandardOutput: pipe];
[aTask setLaunchPath: @"/usr/sbin/netstat"];
[aTask setArguments: args];
[aTask launch];
/* ... */
[aTask terminate];
[aTask release];
aTask = nil;
[pipe release];
pipe = nil;
[handle release];
handle = nil;
}
I'm not very experienced with Cocoa (as you may notice -- I come from Java). The release and retain count are equal so I don't think there should be a memory problem?Program received signal: "EXC_BAD_ACCESS".
Unable to disassemble objc_msgSend_rtp.
Thanks for the help.