Errors using tshark in QProcess
Hello,
I am trying to display the rtt values from a wireshark pcap file. I am using QProcess as follows:
Code:
QString exec
="C:/Progra~1/Wireshark/tshark.exe";
args<< "-r" <<qPrintable(filepath)<<"-Y"<<"tcp.analysis.ack_rtt and tcp.stream eq 0"<<"-e"<<"\"tcp.analysis.ack_rtt\""<<"-T"<<"fields"<<"> C:/it/rtt.txt";
tshark
->start
(exec, args,
QIODevice::ReadWrite);
However, I keep getting the following error using
Code:
qDebug()<<tshark->readAllStandardError();
tshark: Display filters were specified both with "-d" and with additional command-line arguments.
Please advise on what I may be doing wrong. Running from command line produces no errors and works just fine.
Re: Errors using tshark in QProcess
I think there is a number of problems with your code. First you should've quote the arguments yourself unless you want to reach the application quoted (and you probably don't). Second, you might want to split the filter argument into separate tokens unless wireshark expects to receive the filter as a single argument (you would have to quote it out escape the spaces when starting the command from cli). Third, redirection operator is interpreted by the shell and there is no shell here thus '>' will be passed to the application you are running and it probably won't understand it. You will have to intercept the output yourself and stream it to the destination file.
Re: Errors using tshark in QProcess
Quote:
Originally Posted by
wysota
I think there is a number of problems with your code. First you should've quote the arguments yourself unless you want to reach the application quoted (and you probably don't). Second, you might want to split the filter argument into separate tokens unless wireshark expects to receive the filter as a single argument (you would have to quote it out escape the spaces when starting the command from cli). Third, redirection operator is interpreted by the shell and there is no shell here thus '>' will be passed to the application you are running and it probably won't understand it. You will have to intercept the output yourself and stream it to the destination file.
Thanks a lot.. this was very helpful