Look at one of my previous answer:
http://www.experts-exchang
Main Topics
Browse All TopicsHello Everybody, My application captures Ethernet packet and shows all packet data in the Listview control with report view. Right now i am doing it over the main thread of my dialog box. When I handle the GUI (Move or button click or combobox item selection) my packet capture loop which is in do while loop is disturbed (It getting stop).
I have structure which looks like
do
{
if( Catch _the_Packet() == true)
{
Show_Packet_Listview();
}
doev ents();
}while(Stop_cpature!= true);
Now I want to make this packet capture mechanism on the other thread and GUI updates or packet display on main thread.
Which threads should i use.? worker thread to capture packet or GUI thread ? How shpuld i handle the message to update packet listview when packet is captured,
Many Many Thanks in Adavance.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Look at one of my previous answer:
http://www.experts-exchang
Here you can find a sample:
http://www.devhood.com/tut
Another option that I've found simplifies things:
In the worker thread, read the packets and save them into a simple queue structure -- don't display anything.
Then in the GUI thread, create a window timer. At each timer tick, check to see which items have not been displayed and display them. The timer interval can be surprising large without causing the user to see jerking, etc. For instance, even 250ms (4 times a seconds) looks pretty smooth to the human eye.
Business Accounts
Answer for Membership
by: ZoppoPosted on 2009-03-11 at 03:10:23ID: 23855285
Hi SumitKalsait,
I would suggest to implement a worker thread to capture the packets, in this thread you can use SendMessage or SendThreadMessage with a self defined message ID to pass the data to be displayed to the main window or thread.
ZOPPO