0

I was just wondering if i can get number of network connections(hits to my server) made by my application? i am able to get my application information(process name and id) when it is in background with the help of this link running process list

But the struct kp_proc has many subprocesses which have there own subprocesses. so i am not able to guess which particular key will show my network connections list?? Any idea anyone?some process for examplesome process for example

Community
  • 1
  • 1
hemant
  • 1,729
  • 4
  • 31
  • 43

3 Answers3

0

What are you using to make requests? if you are using the native framework so NSURLConnection you can override in a subclass the methods:

+ (NSData *)sendSynchronousRequest:(NSURLRequest *)request returningResponse:(NSURLResponse **)response error:(NSError **)error

+ (void)sendAsynchronousRequest:(NSURLRequest *)request queue:(NSOperationQueue *)queue completionHandler:(void (^)(NSURLResponse*, NSData*, NSError*))handler

- (void)start

and increment a global value to take trace about how many connection have you started during the life time of your application, probably is not the best solution because this not consider the failure, another solution could be use some analytic service like newrelic or similar

Manu
  • 778
  • 5
  • 9
0

Try PonyDebugger, its not perfect, but among many other functions, it shows all all internet calls the app is making https://github.com/square/PonyDebugger

foFox
  • 1,084
  • 1
  • 14
  • 23
0

Maybe lsof (list open files) can be useful to you. It can display open connections (open sockets indeed) for a specific process, eg. for process 99340:

$ lsof -i -a -p 99340
nst
  • 3,841
  • 1
  • 29
  • 40