LocalSocket communication with Unix Domain in Android NDK
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have Android application, which needs to establish unix domain socket connection with our C++ library (using Android NDK) public static String SOCKET_ADDRESS = "your.local.socket.address"; // STRING There is LocalSocket in java which accepts "string" (your.local.socket.address) #define ADDRESS "/tmp/unix.str" /* ABSOLUTE PATH */ struct sockaddr_un saun, fsaun; if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { perror("server: socket"); exit(1); } saun.sun_family = AF_UNIX; strcpy(saun.sun_path, ADDRESS); But the unix domain socket which is