Fixed timeout bug in setCONN and strengthened test for setCONN.

This commit is contained in:
Jason Watkins
2015-04-03 13:59:26 -07:00
parent cfe34f81ea
commit 74cb81b5f7
2 changed files with 6 additions and 2 deletions

View File

@@ -579,11 +579,13 @@ public class XPlaneConnect implements AutoCloseable
ByteArrayOutputStream os = new ByteArrayOutputStream();
os.write("CONN".getBytes(StandardCharsets.UTF_8));
os.write(0xFF); //Placeholder for message length
os.write((byte)recvPort);
os.write((byte)(recvPort >> 8));
os.write((byte) recvPort);
os.write((byte) (recvPort >> 8));
sendUDP(os.toByteArray());
int soTimeout = socket.getSoTimeout();
socket.close();
socket = new DatagramSocket(recvPort);
socket.setSoTimeout(soTimeout);
}
}