From d475a0c0025f5f2a7bd5982495a01f9dd66e9a17 Mon Sep 17 00:00:00 2001 From: curt Date: Tue, 24 Oct 2000 17:15:32 +0000 Subject: [PATCH] Updates to fix a network communication problem. --- src/FDM/ADA.cxx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/FDM/ADA.cxx b/src/FDM/ADA.cxx index d2e1963a9..5457d0635 100644 --- a/src/FDM/ADA.cxx +++ b/src/FDM/ADA.cxx @@ -179,15 +179,16 @@ bool FGADA::update( int multiloop ) { char Buffer[numberofbytes]; // Read FGExternal structure from socket - int result = fdmsock->read(Buffer, numberofbytes); - // Loop to read from top of socket buffer - Last in first out - while (result == numberofbytes) { - result = fdmsock->read(Buffer, numberofbytes); + while (1) { + int result = fdmsock->read(Buffer, numberofbytes); + if (result == numberofbytes) { + // Copy buffer into FGExternal structure + memcpy (&sixdof_to_visuals, &Buffer, sizeof (Buffer)); + } else { + break; + } } - // Copy buffer into FGExternal structure - memcpy (&sixdof_to_visuals, &Buffer, sizeof (Buffer)); - //cout << endl << sixdof_to_visuals.aux18 << endl; // Close Visuals through message/flag from Flight model if (sixdof_to_visuals.aux18 == 1) { -- 2.39.5