I need to read the double speed value of a driving simulator over tcp/ip.
I tried it like this:
Socket s = new Socket(server, port);
InputStream is = s.getInputStream();
DataInputStream dis = new DataInputStream(is);
System.out.println(dis.readDouble());
With BigEndian = true in the configuration of the simulator I get values like this which make no sense:
-1.565600306167059E-119
2.6794374850840603E-248
-2.8742899426422626E-168
-1.858946187722445E-277
1.0067114608326767E54
-0.001054984626127145
-3.862596704088319E-110
4.618147910668653E-193
-9.491033037580185E290
With BigEndian = false the first output is the correct value followed by 7 nonsense values and so on like this:
109.94424404374932
1.0152777137342873E132
3.810036543451522E-70
5.888865755856121E100
-3.430929070370842E67
1.0937105040100144E-105
-1.809009002903045E-259
2.7053994656972186E-23
105.04537620848295
1.304469700127963E126
-1.3728712552450811E284
...
This is what wireshark shows for 1 packet:
Does anyone have an idea how to get only the correct values?