I am relatively new to socket programming in java and want to send data from a Floatbuffer variable over a tcp socket. This should run on an android platform.
Here's some code to illustrate what I want to do:
FloatBuffer buf = FloatBuffer.allocate(4);
buf.put(5.5f);
buf.put(1.5f);
buf.put(2.5f);
buf.put(3.5f);
ServerSocket server = new ServerSocket(38300);
con = server.accept();
// somehow send the whole buf variable over the tcp socket
I am sure you can extract each float and individually send them over the socket, but I wonder if there is a more efficient way to do so?