Re: passing C network structures in JNI
Tuesday, March 23, 2004 02:13 PM
c style pointers are accesible in java as long primitive types, but this can't be used directlly as pointer for mem manipulation, this value can be used as "storage of pointer" for this mem area.
Good pattern is create "jni based" support object for SOCKADDR_IN manipulation - with this long value in constructor. This object can be then safe envelope for this area manipulation, and anyway - take care that only this object can alloc/free this mem. piece to prevent mem colisions. ( do free in finalize )