I am using JPcap Library (Keita Fujii) to capture http packages from my wifi device. That works pretty well, but if the content size of a http response is to large, the packages are fragmented. Actually the psh-Flag of TCPPacket-Class helps me to find out if the response is fragmented, but is this the best method? I am looking for a good solution to merge the data of the fragments. Does someone can give me a hint?
JpcapCaptor captor = JpcapCaptor.openDevice(devices[1], 65535, true,1000);
captor.setFilter("tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)",true);
while (true) {
Packet packet = captor.getPacket();
if (packet == null || packet == Packet.EOF)
break;
TCPPacket tcppacl = (TCPPacket) packet;
if (!tcppacl.psh){
//wait for next package...