style="display:inline-block;width:728px;height:90px"
data-ad-client="ca-pub-7505528228218001"
data-ad-slot="1225241371">

Installation

Using jnetPcap on android studio or eclipse step by step

Hi dear friends ,I am a biginer at jnetPcap on android , I have a big chalange to use jnetPcat in android application.
First of all I have a question,Can I use jnetPcap for making a packet and send to over of network(2nd layer)?
If I can , How do I careate packet with jnetpcap on android? My IDE is android studio.
I downloaded jnetpcap-1.3.0-1.win64.zip on this site after extarcted this file , I add jnetpcap.jar to my android application after that I can call all the classes,but when I want run my app I faced to an error.
My sample code is :

public class PcapAndroidActivity extends Activity {

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
int size = 100;
Ethernet wEth;
byte[] sourceMac = {};
byte[] destMac = {};
Ip4 wIp4;
byte[] bytes = {};
byte[] dIP = {};
byte[] sIP = {};

try {
Process p = Runtime.getRuntime().exec("su");
JPacket wPacket = new JMemoryPacket(size);
wPacket.order(ByteOrder.BIG_ENDIAN);
wPacket.setUShort(12, 0x0800);
wPacket.scan(JProtocol.ETHERNET_ID);
wEth = wPacket.getHeader(new Ethernet());
wEth.source(sourceMac);
wEth.destination(destMac);
wEth.checksum(wEth.calculateChecksum());
int headersize = 14;
wPacket.setUByte(14, 0x40 | 0x05);
wPacket.scan(JProtocol.ETHERNET_ID);
wIp4 = wPacket.getHeader(new Ip4());
wIp4.length(500 - wEth.size());
wIp4.source(dIP);
wIp4.destination(sIP);
wIp4.ttl(32);
wIp4.flags(0);
wIp4.offset(0);
wIp4.checksum(wIp4.calculateChecksum());
headersize += 20;
}
catch (Exception ex)

Using jnetpcap in linux throwing "glibc detected java: malloc(): memory corruption" Error

Hi,

I'm currently using jnetpcap1.4 r1425 version in my project. I'm using offline capture on a pcap file and getting all the sip packets details from the capture file.
I've developed this project on Windows using Eclipse. The project was working fine and I've exported the application as jar and passed the pcap file as argument and i'm getting the desired output and writing it into an external text file.

But now i need to use this application on a linux platform. I've followed all the steps from the link : http://jnetpcap.com/?q=compile/redhat

And i could get the .so files in my usr/lib folder.

When i use the jar file of my application here on linux machine i could see the iteration only on the first few packets (around 2-5) of the capture file and then gets an error.

Even with the sample ClassicPcapExampleOfflineCapture example i get the same error

OUTPUT:

cb_pcap_packet_dispatch() - ENTER
cb_pcap_packet_dispatch() - Java_org_jnetpcap_packet_JScanner_scan
cb_pcap_packet_dispatch() - transferToNewBuffer
cb_pcap_packet_dispatch() - CallVoidMethod
cb_pcap_packet_dispatch() - obj=0x7f6ab455beb8, mid=0x7f6ab036a010, pcap_packet=0x7f6ab009cc30, user=0x7f6ab455beb0
cb_pcap_packet_dispatch() - DeleteLocalRef
cb_pcap_packet_dispatch() - ExceptionCheck
cb_pcap_packet_dispatch() - ENTER
cb_pcap_packet_dispatch() - Java_org_jnetpcap_packet_JScanner_scan
cb_pcap_packet_dispatch() - transferToNewBuffer
cb_pcap_packet_dispatch() - CallVoidMethod
cb_pcap_packet_dispatch() - obj=0x7f6ab455beb8, mid=0x7f6ab036a010, pcap_packet=0x7f6ab009cc48, user=0x7f6ab455beb0
cb_pcap_packet_dispatch() - DeleteLocalRef
cb_pcap_packet_dispatch() - ExceptionCheck
cb_pcap_packet_dispatch() - ENTER
cb_pcap_packet_dispatch() - Java_org_jnetpcap_packet_JScanner_scan
*** glibc detected *** java: malloc(): memory corruption: 0x00007f6ab0c10eb0 ***
======= Backtrace: =========
/lib64/libc.so.6[0x3ab5075f4e]
/lib64/libc.so.6[0x3ab507a41a]

Exception in thread "main" java.lang.UnsatisfiedLinkError: no jnetpcap in java.library.path

Trying to read the pcap file and dump the GPS location related information into a text file
I'm using Eclipse (Eclipse Java EE IDE for Web Developers. Version: Mars.1 Release (4.5.1) Build id: 20150924-1200 )
on windows 7 (SP1) 64 bit Operating system

Downloaded jnetpcap.jar file for 1.3 version for for both 32 and 64 and tried the following code
installed the jar file from Eclipse->project->properties->java buidd path-> Libraries and added the jar file (as explained in one of the options on this site)

public static void main(String[] args) {
final String FILENAME = "c://some.pcap";

final StringBuilder errbuf = new StringBuilder();

final Pcap pcap = Pcap.openOffline(FILENAME, errbuf);
}

in both cases, I'm getting the followimg error
Exception in thread "main" java.lang.UnsatisfiedLinkError: no jnetpcap in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at org.jnetpcap.Pcap.(Unknown Source)
at PCAPTestParser.main(PCAPTestParser.java:20)

What am I doing wrong?

Please help

java.lang.UnsatisfiedLinkError: /usr/lib/libjnetpcap.so: libpcap.so.0.9: cannot open shared object file: No such file or directo

Hi, I am trying to run simple program in CentOS maching but its giving: java.lang.UnsatisfiedLinkError: /usr/lib/libjnetpcap.so: libpcap.so.0.9: cannot open shared object file: No such file or directory. I have put "libjnetpcap.so" downloaded from jnetpcap-1.3 Linux (Generic) inside "/usr/lib" and also set LD_LIBRARY_PATH=/usr/lib. Please help me, what can be the reason?

Build release for Raspberry Pi

I'm trying to build the library from source and get an error during compilation.

I am using the instruction set out here: http://jnetpcap.com/?q=compile/debian using the 1.3 release.

I am running Raspbian 7 (wheezy) on a Raspberry Pi. I made locate script using find as the packaged version didn't seem to do the right thing. this is irrelevant of the error I now have but need to do it to get this far.

Running ant clean test gives these errors (and a few more afterwards)

comp-jni-linux:
     [echo] arch=arm
     [echo] name=Linux
     [echo] Using pcap version 1301
     [echo] compiling JNI C++ files to object code
     [echo] using g++ compiler
     [echo] system include = /usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt/include
       [cc] 30 total files to be compiled.
       [cc] In file included from /usr/monitor/make/jnetpcap/src/c/nio_jbuffer.cpp:27:0:
       [cc] /usr/monitor/make/jnetpcap/src/c/nio_jbuffer.h:55:9: error: uint64_t does not name a type
       [cc] /usr/monitor/make/jnetpcap/src/c/nio_jbuffer.cpp: In function jdouble Java_org_jnetpcap_nio_JBuffer_getDouble0(JNIEnv*, jclass, jlong, jboolean, jint):
       [cc] /usr/monitor/make/jnetpcap/src/c/nio_jbuffer.cpp:135:18: error: nio_uint_ptr was not declared in this scope
       [cc] /usr/monitor/make/jnetpcap/src/c/nio_jbuffer.cpp:135:18: error: expected ) before address
       [cc] /usr/monitor/make/jnetpcap/src/c/nio_jbuffer.cpp:135:38: error: expected ) before ; token
       [cc] /usr/monitor/make/jnetpcap/src/c/nio_jbuffer.cpp:135:38: error: expected ) before ; token
       [cc] /usr/monitor/make/jnetpcap/src/c/nio_jbuffer.cpp: In function jfloat Java_org_jnetpcap_nio_JBuffer_getFloat0(JNIEnv*, jclass, jlong, jboolean, jint):