Modification to blocking bahavior of zts_start, is now settable. Improved address family handling in JNI
This commit is contained in:
@@ -33,6 +33,7 @@ public class ExampleApp {
|
||||
public native int loadsymbols();
|
||||
public native void startOneService();
|
||||
|
||||
// load libzt.dylib or libzt.so
|
||||
static {
|
||||
System.loadLibrary("zt");
|
||||
}
|
||||
@@ -45,11 +46,21 @@ public class ExampleApp {
|
||||
public void run() {
|
||||
System.out.println("starting libzt");
|
||||
libzt.startjoin("/Users/joseph/op/zt/libzt/ztjni", "1212121212121212");
|
||||
System.out.println("started.");
|
||||
// start(path) will not block
|
||||
// startjoin(path, nwid) will block
|
||||
int fd = 0, err = 0;
|
||||
if ((fd = libzt.socket(libzt.AF_INET, libzt.SOCK_STREAM, 0)) < 0) {
|
||||
System.out.println("error creating socket");
|
||||
return;
|
||||
}
|
||||
if ((err = libzt.bind(fd, "0.0.0.0", 3000)) < 0) {
|
||||
System.out.println("error binding socket to virtual interface");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
|
||||
|
||||
while(true)
|
||||
{
|
||||
try { Thread.sleep(3000); }
|
||||
|
||||
Reference in New Issue
Block a user