]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/ExternalNet.cxx
Updates to the electrical system model. "Juice" is now propogated through
[flightgear.git] / src / FDM / ExternalNet.cxx
index 97591c4d0a701de5c1f1cce51412ad00aae898ee..949af690bd8d4106026c215fd8a570ac87c04f07 100644 (file)
@@ -307,14 +307,15 @@ FGExternalNet::FGExternalNet( double dt, string host, int dop, int dip, int cp )
        valid = false;
     }
 
-    // we want to block for incoming data in order to syncronize frame
-    // rates.
-    data_server.setBlocking( false /* don't block while testing */ );
-    // data_server.setBlocking( true /* don't block while testing */ );
+    // disable blocking
+    data_server.setBlocking( false );
+
+    // allowed to read from a broadcast addr
+    // data_server.setBroadcast( true );
 
     // if we bind to fdm_host = "" then we accept messages from
     // anyone.
-    if ( data_server.bind( fdm_host.c_str(), data_in_port ) == -1 ) {
+    if ( data_server.bind( "", data_in_port ) == -1 ) {
         printf("error binding to port %d\n", data_in_port);
        valid = false;
     }
@@ -361,9 +362,13 @@ void FGExternalNet::init() {
     new HTTPClient( fdm_host.c_str(), cmd_port, cmd );
     netChannel::loop(0);
 
+    SG_LOG( SG_IO, SG_INFO, "before sending reset command." );
+
     sprintf( cmd, "/reset?value=ground" );
     new HTTPClient( fdm_host.c_str(), cmd_port, cmd );
     netChannel::loop(0);
+
+    SG_LOG( SG_IO, SG_INFO, "Remote FDM init() finished." );
 }
 
 
@@ -379,9 +384,9 @@ void FGExternalNet::update( double dt ) {
     length = sizeof(ctrls);
     global2raw( &ctrls );
     if ( data_client.send( (char *)(& ctrls), length, 0 ) != length ) {
-       SG_LOG( SG_IO, SG_ALERT, "Error writing data." );
+       SG_LOG( SG_IO, SG_DEBUG, "Error writing data." );
     } else {
-       SG_LOG( SG_IO, SG_ALERT, "wrote control data." );
+       SG_LOG( SG_IO, SG_DEBUG, "wrote control data." );
     }
 
     // Read next set of FDM data (blocking enabled to maintain 'sync')