File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes How can I use the Class JpcapCaptor loopPacket method without blocking my Windows app Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How can I use the Class JpcapCaptor loopPacket method without blocking my Windows app" Watch "How can I use the Class JpcapCaptor loopPacket method without blocking my Windows app" New topic
Author

How can I use the Class JpcapCaptor loopPacket method without blocking my Windows app

Sam Picture
Greenhorn

Joined: Nov 07, 2008
Posts: 2
If I use the Class JpcapCaptor processPacket method this application
gets a run-time "java.lang.NoSuchMethodError: setRoutingOption" error
and it closes, and no packets are captured or displayed. I would like
to be able to use this method because unlike the Class JpcapCaptor
loopPacket method it will not block the application's event dispatching
thread which is used by its graphical user interface and
prevent me from being able to interact with it to stop the capture
process, print the capture information, etc.

If I use the Class JpcapCaptor loopPacket method this application gets
a run-time "java.lang.NoSuchMethodError: setRoutingOption" error and it
continues, and packets are captured and displayed. However, as
previously mentioned this method blocks the application's event
dispatching thread which is used by its graphical user interface
which prevents me from being able to interact with it to stop the
capture process, print the capture information, etc.

Since I cannot use the Class JpcapCaptor processPacket method, I need to
find a way to use the Class JpcapCaptor loopPacket method that will not
block the application's event dispatching thread. One way might
be to have the method use a separate thread, for example a SwingWorker
worker thread. There are probably some other ways to do it, as well.
I am a beginning Java programmer and I do not understand how to do any
of them. I need help! I am visually oriented. Please include
example code, not just text explanations so that I can understand the
solution you propose.

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19670
    
  18

Check out JProgressBar Doesn't Update. Although these days, SwingWorker is a much nicer way to solve it.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Tumelo Modise
Greenhorn

Joined: Oct 18, 2013
Posts: 1
Hi,

Did you manage to the solution to this problem.
if yes, can you please post the solution as I'm faced with the same issue.

Thanks,

Regards
Tumelo Modise
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10246
    
    8

Welcome to the Ranch.
Did you check out the link in Rob's reply above?


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can I use the Class JpcapCaptor loopPacket method without blocking my Windows app