From 472ed4feacff64cbb1ef833c3f7c60db6ebfb021 Mon Sep 17 00:00:00 2001 From: Jason Watkins Date: Fri, 1 May 2015 14:20:44 -0700 Subject: [PATCH] Added check to beginning of C example to ensure that the client is connected to X-Plane. --- C/xpcExample/xpcExample/src/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/C/xpcExample/xpcExample/src/main.cpp b/C/xpcExample/xpcExample/src/main.cpp index 17b2a81..5792368 100644 --- a/C/xpcExample/xpcExample/src/main.cpp +++ b/C/xpcExample/xpcExample/src/main.cpp @@ -23,6 +23,13 @@ int main() // Open Socket const char* IP = "127.0.0.1"; //IP Address of computer running X-Plane XPCSocket sock = openUDP(IP); + float tVal[1]; + int tSize; + if (getDREF(sock, "sim/test/test_float", tVal, &tSize) < 0) + { + printf("Error establishing connecting. Unable to read data from X-Plane."); + return EXIT_FAILURE; + } // Set Location/Orientation (sendPOSI) // Set Up Position Array