Index: test/Makefile.am
===================================================================
--- test/Makefile.am	(revision 101)
+++ test/Makefile.am	(revision 112)
@@ -13,28 +13,28 @@
 endif
 
-basictest_SOURCES=basictest.cc
+basictest_SOURCES=basictest.cc common.cc
 
-basicctest_SOURCES=basicctest.c
+basicctest_SOURCES=basicctest.c ccommon.c
 if TARGET_API_WIN32
 basicctest_LDFLAGS=-lstdc++
 endif
 
-multigettest_SOURCES=multigettest.cc
+multigettest_SOURCES=multigettest.cc common.cc
 
-multigetctest_SOURCES=multigetctest.c
+multigetctest_SOURCES=multigetctest.c ccommon.c
 if TARGET_API_WIN32
 multigetctest_LDFLAGS=-lstdc++
 endif
 
-multisettest_SOURCES=multisettest.cc
+multisettest_SOURCES=multisettest.cc common.cc
 
-multisetctest_SOURCES=multisetctest.c
+multisetctest_SOURCES=multisetctest.c ccommon.c
 if TARGET_API_WIN32
 multisetctest_LDFLAGS=-lstdc++
 endif
 
-hotkeytest_SOURCES=hotkeytest.cc
+hotkeytest_SOURCES=hotkeytest.cc common.cc
 
-hotkeyctest_SOURCES=hotkeyctest.c
+hotkeyctest_SOURCES=hotkeyctest.c ccommon.c
 if TARGET_API_WIN32
 hotkeyctest_LDFLAGS=-lstdc++
@@ -44,4 +44,8 @@
 
 EXTRA_DIST=\
+	common.h		\
+        common.cc		\
+	ccommon.h		\
+	ccommon.cc		\
         runpy.sh                \
         basictest.py            \
Index: test/basicctest.c
===================================================================
--- test/basicctest.c	(revision 89)
+++ test/basicctest.c	(revision 112)
@@ -30,4 +30,6 @@
 
 #include <hu/varadiistvan/xplra/xplra.h>
+
+#include "ccommon.h"
 
 #include <stdio.h>
@@ -57,5 +59,5 @@
 //------------------------------------------------------------------------------
 
-int main()
+int main(int argc, char* argv[])
 {
     static const char* tailNum1 = "VAI";
@@ -86,5 +88,5 @@
 
     printf("Connection to X-Plane...\n");
-    int connectionID = xplra_connect();
+    int connectionID = connect_xplane(argc, argv);
 
     if (connectionID>=0) {
Index: test/basictest.cc
===================================================================
--- test/basictest.cc	(revision 89)
+++ test/basictest.cc	(revision 112)
@@ -29,4 +29,6 @@
 //------------------------------------------------------------------------------
 
+#include "common.h"
+
 #include <hu/varadiistvan/xplra/XPlane.h>
 
@@ -48,5 +50,5 @@
 //------------------------------------------------------------------------------
 
-int main()
+int main(int argc, char* argv[])
 {
     try {
@@ -54,5 +56,5 @@
 
         printf("Connecting to X-Plane...\n");
-        xplane.connect();
+        connectXPlane(xplane, argc, argv);
         printf("Connected to X-Plane.\n\n");
 
Index: test/ccommon.c
===================================================================
--- test/ccommon.c	(revision 112)
+++ test/ccommon.c	(revision 112)
@@ -0,0 +1,58 @@
+// Copyright (c) 2022 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
+#include "ccommon.h"
+
+#include <hu/varadiistvan/xplra/xplra.h>
+
+#include <string.h>
+
+//------------------------------------------------------------------------------
+
+int connect_xplane(int argc, char* argv[])
+{
+    for(int i = 1; i<argc; ++i) {
+        if (strcmp(argv[i], "--tcp")==0) {
+            if ((i+1)<argc) {
+                return xplra_connect_tcp(argv[i+1]);
+            }
+        }
+    }
+
+    return xplra_connect();
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: test/ccommon.h
===================================================================
--- test/ccommon.h	(revision 112)
+++ test/ccommon.h	(revision 112)
@@ -0,0 +1,41 @@
+// Copyright (c) 2022 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#pragma once
+
+//------------------------------------------------------------------------------
+
+int connect_xplane(int argc, char* argv[]);
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: test/common.cc
===================================================================
--- test/common.cc	(revision 112)
+++ test/common.cc	(revision 112)
@@ -0,0 +1,63 @@
+// Copyright (c) 2022 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
+#include "common.h"
+
+#include <hu/varadiistvan/xplra/XPlane.h>
+
+#include <cstring>
+
+//------------------------------------------------------------------------------
+
+using hu::varadiistvan::xplra::XPlane;
+
+//------------------------------------------------------------------------------
+
+void connectXPlane(XPlane& xplane, int argc, char* argv[])
+{
+    for(int i = 1; i<argc; ++i) {
+        if (strcmp(argv[i], "--tcp")==0) {
+            if ((i+1)<argc) {
+                xplane.connectTCP(argv[i+1]);
+                return;
+            }
+        }
+    }
+
+    xplane.connect();
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: test/common.h
===================================================================
--- test/common.h	(revision 112)
+++ test/common.h	(revision 112)
@@ -0,0 +1,50 @@
+// Copyright (c) 2022 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#pragma once
+
+//------------------------------------------------------------------------------
+
+namespace hu { namespace varadiistvan { namespace xplra {
+
+class XPlane;
+
+} } }
+
+//------------------------------------------------------------------------------
+
+void connectXPlane(hu::varadiistvan::xplra::XPlane& xplane,
+                   int argc, char* argv[]);
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: test/hotkeyctest.c
===================================================================
--- test/hotkeyctest.c	(revision 55)
+++ test/hotkeyctest.c	(revision 112)
@@ -31,4 +31,6 @@
 #include <hu/varadiistvan/xplra/xplra.h>
 
+#include "ccommon.h"
+
 #include <stdio.h>
 #include <string.h>
@@ -57,5 +59,5 @@
 //------------------------------------------------------------------------------
 
-int main()
+int main(int argc, char* argv[])
 {
     int retval = 0;
@@ -65,5 +67,5 @@
 
     printf("Connecting to X-Plane...\n");
-    int connectionID = xplra_connect();
+    int connectionID = connect_xplane(argc, argv);
 
     if (connectionID>=0) {
Index: test/hotkeytest.cc
===================================================================
--- test/hotkeytest.cc	(revision 54)
+++ test/hotkeytest.cc	(revision 112)
@@ -33,4 +33,6 @@
 #include <hu/varadiistvan/scpl/Thread.h>
 
+#include "common.h"
+
 #include <cstdio>
 #include <cstring>
@@ -48,5 +50,5 @@
 //------------------------------------------------------------------------------
 
-int main()
+int main(int argc, char* argv[])
 {
     try {
@@ -54,5 +56,5 @@
 
         printf("Connecting to X-Plane...\n");
-        xplane.connect();
+        connectXPlane(xplane, argc, argv);
         printf("Connected to X-Plane.\n\n");
 
Index: test/multigetctest.c
===================================================================
--- test/multigetctest.c	(revision 41)
+++ test/multigetctest.c	(revision 112)
@@ -30,4 +30,6 @@
 
 #include <hu/varadiistvan/xplra/xplra.h>
+
+#include "ccommon.h"
 
 #include <stdlib.h>
@@ -141,5 +143,5 @@
 
     printf("Connecting to X-Plane...\n");
-    connectionID = xplra_connect();
+    connectionID = connect_xplane(argc, argv);
     if (connectionID>=0) {
         printf("Connected to X-Plane.\n\n");
Index: test/multigettest.cc
===================================================================
--- test/multigettest.cc	(revision 41)
+++ test/multigettest.cc	(revision 112)
@@ -34,4 +34,6 @@
 #include <hu/varadiistvan/scpl/Thread.h>
 
+#include "common.h"
+
 #include <cstdio>
 #include <cstring>
@@ -61,5 +63,5 @@
 
         printf("Connecting to X-Plane...\n");
-        xplane.connect();
+        connectXPlane(xplane, argc, argv);
         printf("Connected to X-Plane.\n\n");
 
Index: test/multisetctest.c
===================================================================
--- test/multisetctest.c	(revision 30)
+++ test/multisetctest.c	(revision 112)
@@ -30,4 +30,6 @@
 
 #include <hu/varadiistvan/xplra/xplra.h>
+
+#include "ccommon.h"
 
 #include <stdlib.h>
@@ -66,5 +68,5 @@
 
     printf("Connecting to X-Plane...\n");
-    connectionID = xplra_connect();
+    connectionID = connect_xplane(argc, argv);
     if (connectionID>=0) {
         printf("Connected to X-Plane.\n\n");
Index: test/multisettest.cc
===================================================================
--- test/multisettest.cc	(revision 26)
+++ test/multisettest.cc	(revision 112)
@@ -34,4 +34,6 @@
 #include <hu/varadiistvan/scpl/Thread.h>
 
+#include "common.h"
+
 #include <cstdio>
 #include <cstring>
@@ -60,5 +62,5 @@
 
         printf("Connecting to X-Plane...\n");
-        xplane.connect();
+        connectXPlane(xplane, argc, argv);
         printf("Connected to X-Plane.\n\n");
 
