44 #include "FGUDPInputSocket.h"
45 #include "FGFDMExec.h"
46 #include "input_output/FGXMLElement.h"
56 FGUDPInputSocket::FGUDPInputSocket(
FGFDMExec* fdmex) :
60 SockProtocol = FGfdmSocket::ptUDP;
75 while (property_element) {
76 string property_str = property_element->
GetDataLine();
79 cerr <<
fgred <<
highint << endl <<
" No property by the name "
80 << property_str <<
" can be found." <<
reset << endl;
82 InputProperties.push_back(node);
94 if (socket == 0)
return;
96 data = socket->Receive();
98 if (data.size() > 0) {
100 vector<string> tokens;
101 stringstream ss(data);
103 while (getline(ss, temp,
',')) {
104 tokens.push_back(temp);
107 vector<double> values;
109 for (
unsigned int i=0; i<tokens.size(); i++) {
110 values.push_back( atof(tokens[i].c_str()) );
113 if (values[0] < oldTimeStamp) {
116 oldTimeStamp = values[0];
120 if ((values.size() - 1) != InputProperties.size()) {
121 cerr << endl <<
"Mismatch between UDP input property and value counts." << endl;
125 for (
unsigned int i=1; i<values.size(); i++) {
126 InputProperties[i-1]->setDoubleValue(values[i]);