Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7717403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:53:21+00:00 2026-06-01T02:53:21+00:00

I am using Pcapdot.net DLLs in order to send buffer of packets to my

  • 0

I am using Pcapdot.net DLLs in order to send buffer of packets to my network adapter. I checked my Wireshark file and collected all the information e.g number of packets, duration etc..
My main class sends the buffer and has several properties (number of packets, duration..) In the main thread I am checking this class with BackgroundWorker.ProgressChanged:

            bgWoSingle = new BackgroundWorker();
            bgWoSingle.WorkerReportsProgress = true;
bgWoSingle.ProgressChanged += new ProgressChangedEventHandler(bgW_ProgressChanged);

Every packet inside Wireshark file has a timstamp and of course I can send this buffer in other speed rate by increasing or decreasing the timestamp between the packets.
now my problem is:

One of the properties I am checking is how many packets I have already sent. Because I know how many packets my file contains, I can show the progress via progress bar. If I am changing the send rate to maximum by deleting all the delay between the packets play, the speed is so fast and the progress bar and all the UI stuck until it’s finished sending all the packets. How can I change it? Maybe update my ProgressBar via another thread?

this is my function who check my class:

  void bgW_ProgressChanged(object sender, ProgressChangedEventArgs e)
  {
    //bla bla bla (check all Class properties)

        pcap = e.UserState as Pcap;
        progressBar1.Value = e.ProgressPercentage; //here is my progressBar update


    //bla bla bla (check all Class properties)
  }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T02:53:23+00:00Added an answer on June 1, 2026 at 2:53 am

    I don’t know Pcapdot.net, but I know Winforms so I can give you a couple of hints.

    It appears that your UI is stuck in the sense that the window is unresponsive (you cannot click active buttons or edit textboxes, and if you try the window becomes gray). In that case you do have a threading problem. I don’t know if that BackgroundWorker is a library class or one that you made, but you must be sure that any I/O operation is done in another thread. While the name suggests that it happens, I’m not sure about how you start the process against what is supposed by the API. For example, certain libraries allow you to call a start method that forks another thread, while others require you to call an execute method from a thread you already forked. This makes the difference.

    In order to update your UI from a non-UI thread you must always use [Control.Invoke][1] method (if you need to pause your thread until UI gets updated) or Control.BeginInvoke (if you want to proceed ASAP).

    My Lambda-fu is not trained daily, so please correct me if I make an error in my syntax

    progressBar1.Invoke(delegate() {progressBar1.Value = e.ProgressPercentage;});
    

    In the second case in which your UI is stuck in the sense that the progress bar won’t progress, first make sure that the event is fired. Second and most important, you cannot update UI from a non-UI thread. Imperative!

    If you run that progressChanged method inside a try-catch I see troubles, because when you update the progressBar percentage you get an exception that could be masked. I also hope that ProcessPercentage is an integer between 0 and 100 and not a double between 0 and 1, something that causes the bar not to apparently progress.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using C#.NET, i wrote a toolbar which is stored now into toolbar.cs file. I
Using the Redis info command, I am able to get all the stats of
Using ASIHTTPRequest, I downloaded a zip file containing a folder with several audio files.
Using System.Diagnostics.EventLog .NET type one can programmatically create logs into the Event Viewer application.
Using ASP.NET MVC 4 RTW, how do I log MVC controller actions and parameters
Using JNotify in project and it fulfill my all requirements, but some times it
How can I split a packet into two packets using pcapdotnet? This is what
Using JSTL's forEach tag, is it possible to iterate in reverse order?
using this code I can send one texture to the shader: devcon->PSSetShaderResources(0, 1, &pTexture);
i have Winform application who run all the files within listbox, i am using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.