I have adapted it - now it is compiling correct, but the output in terminal is strange:
NSDictionary *tmpDict = [NSDictionary dictionaryWithDictionary:@"SCNetworkConnectionCopyStatistics(scncRef)"];
id o = [[tmpDict objectForKey:@"PPP"] objectForKey:@"BytesOut"]; if( o!= nil) printf("%i\n", [o intValue]); else printf("nicht verbunden\n");
iBook-G4:~/stats/build/Debug sl$ ./stats -o Outgoing 2007-10-03 21:14:57.051 stats[3028] *** _NSAutoreleaseNoPool(): Object 0x50f290 of class NSCFString autoreleased with no pool in place - just leaking 2007-10-03 21:14:57.052 stats[3028] *** -[NSCFString count]: selector not recognized [self = 0x25044] 2007-10-03 21:14:57.053 stats[3028] *** _NSAutoreleaseNoPool(): Object 0x50da20 of class NSCFString autoreleased with no pool in place - just leaking 2007-10-03 21:14:57.054 stats[3028] *** _NSAutoreleaseNoPool(): Object 0x50b2a0 of class NSCFString autoreleased with no pool in place - just leaking 2007-10-03 21:14:57.054 stats[3028] *** _NSAutoreleaseNoPool(): Object 0x50b280 of class NSException autoreleased with no pool in place - just leaking 2007-10-03 21:14:57.055 stats[3028] *** Uncaught exception: <NSInvalidArgumentException> *** -[NSCFString count]: selector not recognized [self = 0x25044] Trace/BPT trap iBook-G4:~/stats/build/Debug sl$
I am sorry for stealing your time, but I am not able to deal with that...
Thanks for your help!
Stefan
On Oct 3, 2007, at 9:03 PM, Stefan Lehrner wrote: Mike helped me with that:
NSDictionary *tmpDict = [NSDictionary dictionaryWithDictionary:SCNetworkConnectionCopyExtendendStatus(scncRef)];
id a = [[tmpDict objectForKey:@"PPP"] objectForKey:@"ConnectTime"]; if( a!= nil) printf("%i\n", [a intValue]); else printf("nicht verbunden\n");
The following occurs now:
1) When compiling I get the following: warning passing argument 1 of 'dictionarywithDictionary:' makes pointer from integer without a cast 2) When running in terminal (-t) I get:
Time ZeroLink: unknown symbol '_SCNetworkConnectionCopyExtendendStatus' Abort trap
Thanks for your time!
Best Regards,
Stefan
On Oct 3, 2007, at 8:25 PM, Stefan Lehrner wrote: Hi,
can someone please help me?
I need to get the "ConnectTime" from the Dictionary "SCNetworkConnectionExtendedStatus" subdirectory "PPP"
Sorry, I have no idea how to fetch this... I tried
id a = [[SCNetworkConnectionCopyExtendedStatus objectForKey:@"PPP"] objectForKey:@"ConnectTime"]; if (a != NULL) { printf ("%i\n", [a intValue]); } else { printf ("nicht verbunden\n"); }
But it compiled with an error message: /Users/sl/stats/stats.m:85: warning: invalid receiver type '¿¿v'
Maybe someone can bring into the darkness?
Thanks for your help,
Stefan
|