我正在编写一个程序来打开一个pcap文件,然后过滤一些数据包,然后将数据包数据作为字符串写入文件,但我不知道为什么这个程序在打开pcap文件后什么都不做。
int rtsp=0;
FileWriter fstream2=新FileWriter("E:\write2.txt",true);
BufferedWriter fbw2=新的BufferedWriter(fstream2);
System.out.println("RTSP:");JpcapCaptor captor2=JpcapCaptor.openFile("E:\rtsp_with_data_over_tcp.pcap");
而(true){
数据包packet2=captor2.getPacket();
if(packet2==null ||packet2==Packet.EOF)break;
rtsp=rtsp+1;String PacketData2=新字符串(packet2.data);
fbw2.write(数据包数据2);
fbw2.newLine()
}
fbw2.close();
captor2.close();
System.out.println("RTSP:"+RTSP);
即使是最后一次打印的声明也不起作用。
有人能指引我吗!
根据rtsp使用的默认端口,您可以过滤
rtsp 554/tcp Real Time Stream Control Protocol
rtsp 554/udp Real Time Stream Control Protocol
rtsp-alt 8554/tcp RTSP Alternate (see port 554)
rtsp-alt 8554/udp RTSP Alternate (see port 554)
http://www.cs.columbia.edu/~hgs/rtsp/