Please give me some examples (code on both languages) on how to send float array from c# to Java via socket. Thanks.
-
5Alex, this is not how it works here. You don't just ask for code. You show what you did, explain where you hit a problem, and ask for for help. The question how it's worded now is begging the RTFM answer.Nikolai Fetissov– Nikolai Fetissov2011-04-14 12:11:39 +00:00Commented Apr 14, 2011 at 12:11
4 Answers
You cannot directly send them since the two float[] are not interoperable. You have to go for a standard protocol to share them. SOAP could be one of them.
1 Comment
You somehow have to convert your floats on one side to bytes, write them to the output-stream of the socket, read them from the input-stream of the socket, and convert those back to floats.
There is the IEEE 754 standard which defines a bit layout - in Java this is implemented by Float.floatToIntBits and Float.intBitsToFloat, and also by the readFloat/writeFloat methods of DataInputStream.
I suppose there will be a similar method on the .NET side, but I don't know anything about this.