• 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
Re: SCNetworkConnection - Dictionary/Subdictionary
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SCNetworkConnection - Dictionary/Subdictionary


  • Subject: Re: SCNetworkConnection - Dictionary/Subdictionary
  • From: Jaime Magiera <email@hidden>
  • Date: Thu, 4 Oct 2007 03:54:05 -0400


On Oct 3, 2007, at 3:15 PM, Stefan Lehrner wrote:

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");

These questions are actually Cocoa related. The Cocoa-Dev mailing list would be a good place to ask them. Above, you are literally just creating a string "SCNetworkConnectionCopyStatistics(scncRef)" . Obviously, that's not going to work. You were closer with the previous version.


// First, you need to coerce the Dictionary from CFDictionaryRef, which is returned by SCNetworkConnectionCopyExtendendStatus, to an NSDictionary.
// (http://developer.apple.com/documentation/Cocoa/Conceptual/ CarbonCocoaDoc/Articles/interchangeableDataTypes.html#//apple_ref/doc/ uid/20002401)


NSDictionary *tmpDict = [NSDictionary dictionaryWithDictionary: (NSDictionary *)SCNetworkConnectionCopyExtendendStatus(scncRef)];

// Now, I don't know know the value types for the dictionary objects, you'll have to look that up. However, I'd bet for connection time that it is an NSNumber. So, you'd do something like...


NSNumber *a = [[tmpDict objectForKey:@"PPP"] objectForKey:@"ConnectTime"];
if( a!= nil)
printf("%i\n", [a intValue]);
else
printf("nicht verbunden\n");


You might want to consider reading up on Cocoa programming. (Not that I'm any expert)

Jaime Magiera
Sensory Research Network
http://www.sensoryresearch.net




_______________________________________________ Do not post admin requests to the list. They will be ignored. Macnetworkprog mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Re: SCNetworkConnection - Dictionary/Subdictionary (From: Stefan Lehrner <email@hidden>)
 >Re: SCNetworkConnection - Dictionary/Subdictionary (From: Stefan Lehrner <email@hidden>)

  • Prev by Date: Re: SCNetworkConnection - Dictionary/Subdictionary
  • Next by Date: (no subject)
  • Previous by thread: Re: SCNetworkConnection - Dictionary/Subdictionary
  • Next by thread: (no subject)
  • Index(es):
    • Date
    • Thread