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 8589039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:56:56+00:00 2026-06-11T22:56:56+00:00

I am open WireShark using command line and start capture the packets, when i

  • 0

I am open WireShark using command line and start capture the packets, when i do it using CMD windows i can see the number of the incoming packets and this number i want to show in my application form (win form), currently this is my code but my application crash with error

static void Main(string[] args)
{
    try
    {
        string _pcapPath = @"C:\test.pcap";
        Process _tsharkProcess = new Process();
        _tsharkProcess.StartInfo.FileName = @"C:\Program Files\Wireshark\tshark.exe";
        _tsharkProcess.StartInfo.Arguments = string.Format(" -i " + 2 + " -c " + int.MaxValue + " -w " + _pcapPath);
        _tsharkProcess.OutputDataReceived += new DataReceivedEventHandler(process_OutputDataReceived);
        _tsharkProcess.StartInfo.RedirectStandardOutput = true;
        _tsharkProcess.StartInfo.UseShellExecute = false;
        //_tsharkProcess.StartInfo.CreateNoWindow = true;
        //_tsharkProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
        _tsharkProcess.Start();
        StreamReader myStreamReader = _tsharkProcess.StandardOutput;
        string myString = myStreamReader.ReadLine(); //read the standard output of the spawned process. 
        Console.WriteLine(myString);
        _tsharkProcess.WaitForExit();
    }
    catch (Exception)
    {

    }

}

private static void process_OutputDataReceived(object sender, DataReceivedEventArgs e)
{
    string srt = e.Data; //arg.Data contains the output data from the process...  
}
  • 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-11T22:56:57+00:00Added an answer on June 11, 2026 at 10:56 pm

    You can try with this code

    Nota : Set these lines before start

                process.StartInfo.RedirectStandardOutput = true;
                process.StartInfo.UseShellExecute = false;
                process.Start();
    

    Code:

                Process process = new Process();
                process.StartInfo.FileName = @"C:\Program Files\Wireshark\tshark.exe";
                process.StartInfo.Arguments = string.Format(" -i " + _interfaceNumber + " -c " + int.MaxValue + " -w " + _pcapPath);
                process.OutputDataReceived += new DataReceivedEventHandler(process_OutputDataReceived);
    
                process.StartInfo.RedirectStandardOutput = true;
                process.StartInfo.UseShellExecute = false;
    
    
           process.Start();
    
                StreamReader myStreamReader = process.StandardOutput;
                // Read the standard output of the spawned process. 
                string myString = myStreamReader.ReadLine();
                Console.WriteLine(myString);
    
                process.WaitForExit();
                process.Close();
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

open message box and long click on a message , as you can see
Open-Source Security Testing Methodology (OSSTMM) can this testing metholody applied for software applications for
Open up this site in IE8: http://www.bavarianblue.com See the white background? Any ideas what
Open Ankh seems to be using Subversion 1.6.2 and Tortoise uses Subversion 1.6.0. After
I open a html page with a myApp.js included like this: <html> <body> ......
When open a query in Microsoft project, the start date changes. Please note that,
I'm writing some code using PacketDotNet and SharpPCap to parse H.225 packets for a
The site I'm trying to spider is using the javascript: request.open(POST, url, true); To
Greeting, This month I will start working on my master thesis. My thesis's subject
(See this question in ServerFault ) I have a Java client that uses Socket

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.