I am writing an NDK app and want to add UDP connectivity over wifi. I could use java.net to create sockets, but are they efficient? Most of my code is C++ so I need to use JNI to communicate with the java socket layer. How can I efficiently pass buffers of packet data of arbitrary length (sequences of bytes) via JNI between the java layer and the C++ layer?
Is there any reason I should not use linux sockets, which avoid the need for the java/JNI interface? It would seem much easier, but is it discouraged, or regarded as bad practice? And would there be technical problems? Are they less secure?
I can't find any NDK wrapper for UDP sockets - I presume there is no such module?
I am writing an NDK app and want to add UDP connectivity over wifi. I could use java.net to create sockets, but are they efficient? Most of my code is C++ so I need to use JNI to communicate with the java socket layer. How can I efficiently pass buffers of packet data of arbitrary length (sequences of bytes) via JNI between the java layer and the C++ layer?Is there any reason I should not use linux sockets, which avoid the need for the java/JNI interface? It would seem much easier, but is it discouraged, or regarded as bad practice? And would there be technical problems? Are they less secure?
I can't find any NDK wrapper for UDP sockets - I presume there is no such module?