Hi, I have a requirement to launch the multiple wireshark instances for multiple trace files from my application. For example, number M subscribers are monitored in number N nodes/server, it will lead to N*M wireshark windows opened. Because of these many wireshark instance memory consumption is huge. I would like to threshold the number of wireshark instances to be opened at a time (for ex. 10 instances). So when user tries to open the 11th wireshark instance that should not be allowed. I can know the number of wireshark instance open, but how could I find that when a wireshark window is closed, my application get the notification so that it allows to open the other wireshark instance? please help. asked 04 Dec '12, 04:03 manojdeoli edited 04 Dec '12, 04:04 |
One Answer:
Try calling the method exitValue() of the Process object. HINT: This is more a Java question than a Wireshark question and you might get better answers in forum dedicated to Java programming. Regards answered 05 Dec '12, 11:22 Kurt Knochner ♦ edited 05 Dec '12, 12:45 |
on a side note... I'd use dumpcap directly instead of Wireshark, because if your only intent is to capture you do not need Wireshark at all, and can spare a lot of memory. Dumpcap is the capture tool used by Wireshark to capture the actual data, and is installed in the same program directory.
How do you start Wireshark within your application?
I have java application, and I am launching it with CLI command: wireshark <path of="" trace="" file="">.
can you please post the java code? Just the lines that start the external application.
Here is code:
final String wiresharkLocation = "/usr/local/bin/"; final String cmd = wiresharkLocation+"wireshark /tmp/manoj/7898.pcap" ; System.out.println(" cmd for launchWireshark : " + cmd); try { Process process = Runtime.getRuntime().exec(cmd); } catch (Exception e) { e.printStackTrace(); System.out.println("Exception at Wireshark launch. " + e); }