Updates to fix a network communication problem.
This commit is contained in:
parent
7cc98ad15f
commit
d475a0c002
1 changed files with 8 additions and 7 deletions
|
@ -179,15 +179,16 @@ bool FGADA::update( int multiloop ) {
|
||||||
char Buffer[numberofbytes];
|
char Buffer[numberofbytes];
|
||||||
|
|
||||||
// Read FGExternal structure from socket
|
// Read FGExternal structure from socket
|
||||||
int result = fdmsock->read(Buffer, numberofbytes);
|
while (1) {
|
||||||
// Loop to read from top of socket buffer - Last in first out
|
int result = fdmsock->read(Buffer, numberofbytes);
|
||||||
while (result == numberofbytes) {
|
if (result == numberofbytes) {
|
||||||
result = fdmsock->read(Buffer, 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;
|
//cout << endl << sixdof_to_visuals.aux18 << endl;
|
||||||
// Close Visuals through message/flag from Flight model
|
// Close Visuals through message/flag from Flight model
|
||||||
if (sixdof_to_visuals.aux18 == 1) {
|
if (sixdof_to_visuals.aux18 == 1) {
|
||||||
|
|
Loading…
Reference in a new issue