Results 1 to 2 of 2

Thread: QThread based Sniffer

  1. #1
    Join Date
    Jul 2009
    Posts
    3
    Thanks
    2

    Default QThread based Sniffer

    Hi , I am quite a newbie to QT, but now there is a problem bugging me, I have a working sniffer code and i successfully integrate it into my QT 4.5 GUI. what i want to do is to display the sniffing result on some widgets.

    Inside the sniffer, there is a while (1) loop which keeps the packet sniffer running, now this problem is ,if the sniffer portion in my QT GUI runs in command line, it will freeze the GUI because of this while (1) loop. The sniffer is working, i can see the result in Application Output.

    So I found a way of using QThread to independently run the sniffer and trying to retrieve the output from the running thread and display them on my main window widget.

    Please kindly advise me how can i achieve that, I have already got the sniffer and Qthread build( in some dummy function), now its just how to get the running result out of the thread and display them ....


    Please help, many many many thanks

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QThread based Sniffer

    the easiest way is to emit signals and connect those to your gui's slots. (You can also put custom events into your app's event loop, but that is a bit more work.)

Similar Threads

  1. QThread and QTimer
    By sivrisinek in forum Qt Programming
    Replies: 4
    Last Post: 30th April 2009, 16:41
  2. QThread and QTcpSocket
    By ^NyAw^ in forum Qt Programming
    Replies: 3
    Last Post: 12th May 2008, 13:06
  3. Spawn a QThread in another QThread
    By david.corinex in forum Qt Programming
    Replies: 2
    Last Post: 19th December 2007, 12:54
  4. QThread exec proplem to stop...
    By patrik08 in forum Qt Programming
    Replies: 29
    Last Post: 21st May 2007, 07:51
  5. Is it possible to create a QThread without inheriting ?
    By probine in forum Qt Programming
    Replies: 6
    Last Post: 23rd March 2006, 22:51

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.