Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-users: [Wireshark-users] Launching Wireshark from .NET and reading pcap data from stdin

From: Jim Balo <jimbalo22@xxxxxxxxx>
Date: Sat, 11 Oct 2008 10:26:45 -0700 (PDT)
Hi,
 
I working on a .NET app to help analyze pcap files.  I am trying to figure out how to launch Wireshark and pass it the pcap data via standard in. 
 
Here is what I tried:
 
Process process = new Process();
process.StartInfo.FileName = @"C:\Program Files\Wireshark\wireshark.exe";
process.StartInfo.Arguments = "-k -i -";
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardInput = true;
process.Start();
process.StandardInput.BaseStream.Write(packetArray, 0, packetArray.Length); // packetArray is byte array of raw packet data, including pcap header, etc.
process.Close();
 
Wireshark starts just fine, but it does not read what I send to stdin (in the status bar, it says, "Waiting for capture data...")
 
Any help on this would be great!
 
Thanks,
JB
 
Ps. Writing the same stream to a file and launching "Wireshark -r filename" works fine, so the pcap data is valid.