Network Monitoring

by blues » Wed, 29 Oct 2008 14:16:28 GMT


Sponsored Links
 Is there a way to monitor the IP traffic? For example throughput?
If not in java, can it be done through native code? I have seen some
IP sniffer source code for linux.
--~--~---------~--~----~------------~-------~--~----~



Network Monitoring

by brs » Wed, 29 Oct 2008 19:34:53 GMT


 You could try to read

/proc/self/net/dev
/proc/self/net/snmp

to get interface and protocol level stats. I guess since this is not
part of the public API, there is not guarantee that these formats
won't change, but for now at least this information might be what you
are looking for.

Bernhard



--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Network Monitoring

by blues » Thu, 30 Oct 2008 02:57:18 GMT


 Can we read from Java? Any permission is required?

Blues




--~--~---------~--~----~------------~-------~--~----~



Network Monitoring

by brs » Thu, 30 Oct 2008 12:01:29 GMT


 No special permissions needed as far as I know - just read them like a
regular file. For example, I was using code like this for a prototype
network monitoring app (I am no java expert - this is mostly cut &
paste):

FileReader fstream;
try {
 fstream = new FileReader("/proc/self/net/dev");
} catch (FileNotFoundException e) {
...
}
BufferedReader in = new BufferedReader(fstream, 500);
String line;
try {
 while ((line = in.readLine()) != null) {
...


Bernhard







--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. startActivity(ForResult) at Activity start (on/Create/Start/Resume) not working

I'am trying to start a child Activity with startActivity(ForResult)
when the main Activity starts. It doesn't work. If the child Activity
used Theme.Dialog it doesn't show up at all. With a normal Theme it's
displayed, but when I close the top child activity, a RuntimeException
is thrown:

ActivityThread.performResumeActivity(IBinder, boolean) line: 2851
ActivityThread.handleResumeActivity(IBinder, boolean, boolean) line:
2866
BinderProxy(ActivityThread$H).handleMessage(Message) line: 1819
ActivityThread$H(Handler).dispatchMessage(Message) line: 99
Looper.loop() line: 123
ActivityThread.main(String[]) line: 4203
Method.invokeNative(Object, Object[], Class, Class[], Class, int,
boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 521
ZygoteInit$MethodAndArgsCaller.run() line: 791
ZygoteInit.main(String[]) line: 549
NativeStart.main(String[]) line: not available [native method]

There is no problem calling startActivity(ForResult) on a click or
menu selection. Should I use any intent flags?

-- 

2. How to create menu after user clicks a button or any other place in my View object?

Hello all,
I think I have to create two kinds of menus:
First occasion: when user clicks on a Button/ImageButton, then dropdown a
menu to let user select some options
Second, I drawed some data in a derived View myself. How to pop up a context
menu if user clicks anywhere?

Is there any suggestion?

Thanks

-- 

3. How to create picasa app??

4. Anybody need a resource for cheap App Design?

5. Play Video resolusi 1280x720

6. Timeout in BroadcastReceivers using IntentServices

7. Sprite cropping like SpriteMethodTest OpenGL ES