Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Sam Picture
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20546
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out JProgressBar Doesn't Update. Although these days, SwingWorker is a much nicer way to solve it.
 
Tumelo Modise
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11070
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.
Did you check out the link in Rob's reply above?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic