On May 4, 2012, at 12:36 AM, Stefan Billeb wrote:
> I am developing with jNetPcap on Java which is (most of you will know) a
> wrapper for winpcap.
>
> When I try to open an offline capture pcap file and the path to the file
> contains whitespaces an exception is thrown and it cannot get opened.
It works with libpcap:
$ tcpdump -n -r ~/captures/hpteaming/"teaming heartbeat.pcap"
reading from file /Users/gharris/captures/hpteaming/teaming
heartbeat.pcap, link-type EN10MB (Ethernet)
13:24:00.137165 LLDP, length 93: PROCURVE J9029A
13:24:30.266764 LLDP, length 93: PROCURVE J9029A
13:25:00.397212 LLDP, length 93: PROCURVE J9029A
...
and should Just Work with WinPcap as well - a space is not a particular special
character in file names in any UN*X or Windows APIs (it might be a special
character on the *command line* for UN*X or Windows, but that's a separate
matter).
Perhaps either
1) Java is doing something silly with spaces in strings;
2) jNetPcap is doing something silly with spaces in strings;
3) something *else* is causing the problem.
What type of exception is being thrown?
Do you mean that in
> // code snippet
> final StringBuilder errbuf = new StringBuilder();
>
> Pcap pcap = Pcap.openOffline(filename, errbuf);
>
> if(pcap == null) {
> System.err.printf("Error while opening device for capture: "
> + errbuf.toString());
>
> return false;
> }
an exception is thrown in Pcap.openOffline and it never even gets to the
"if(pcap == null)" test?
_______________________________________________
Winpcap-users mailing list
[email protected]
https://www.winpcap.org/mailman/listinfo/winpcap-users