Index: src/client/c/hu/varadiistvan/xplra/XPlane.cc
===================================================================
--- src/client/c/hu/varadiistvan/xplra/XPlane.cc	(revision 107)
+++ src/client/c/hu/varadiistvan/xplra/XPlane.cc	(revision 110)
@@ -35,4 +35,5 @@
 
 #include <hu/varadiistvan/scpl/io/LocalClientSocket.h>
+#include <hu/varadiistvan/scpl/io/TCPClientSocket.h>
 #include <hu/varadiistvan/scpl/io/DataStream.h>
 
@@ -52,5 +53,5 @@
 
 using hu::varadiistvan::scpl::io::LocalClientSocket;
-using hu::varadiistvan::scpl::io::LocalConnector;
+using hu::varadiistvan::scpl::io::TCPClientSocket;
 using hu::varadiistvan::scpl::io::DataStream;
 
@@ -60,4 +61,40 @@
 using std::string;
 using std::min;
+
+//------------------------------------------------------------------------------
+
+const unsigned short XPlane::defaultTCPPort;
+
+//------------------------------------------------------------------------------
+
+template <class ClientSocket>
+void XPlane::connect(std::unique_ptr<ClientSocket> clientSocket)
+{
+    auto& connector = clientSocket->getConnector();
+
+    while (!connector.connect()) {
+        if (connector.failed()) {
+            throw IOException(connector.getErrorCode());
+        }
+        waiter.wait();
+        if (waiter.failed()) {
+            throw IOException(waiter.getErrorCode());
+        }
+    }
+
+#ifndef _WIN32
+    signal(SIGPIPE, SIG_IGN);
+#endif
+
+    socket = clientSocket.release();
+    stream = new DataStream(*socket);
+
+    for(multiBuffers_t::iterator i = multiBuffers.begin();
+        i!=multiBuffers.end(); ++i)
+    {
+        MultiBuffer* buffer = *i;
+        buffer->reregisterInXPlane();
+    }
+}
 
 //------------------------------------------------------------------------------
@@ -150,29 +187,17 @@
     unique_ptr<LocalClientSocket> clientSocket(new LocalClientSocket("xplra",
                                                                      &waiter));
-    LocalConnector& connector = clientSocket->getConnector();
-
-    while (!connector.connect()) {
-        if (connector.failed()) {
-            throw IOException(connector.getErrorCode());
-        }
-        waiter.wait();
-        if (waiter.failed()) {
-            throw IOException(waiter.getErrorCode());
-        }
-    }
-
-#ifndef _WIN32
-    signal(SIGPIPE, SIG_IGN);
-#endif
-
-    socket = clientSocket.release();
-    stream = new DataStream(*socket);
-
-    for(multiBuffers_t::iterator i = multiBuffers.begin();
-        i!=multiBuffers.end(); ++i)
-    {
-        MultiBuffer* buffer = *i;
-        buffer->reregisterInXPlane();
-    }
+    connect(std::move(clientSocket));
+}
+
+//------------------------------------------------------------------------------
+
+void XPlane::connectTCP(const std::string& address, unsigned short port)
+{
+    if (socket!=0) return;
+
+    unique_ptr<TCPClientSocket> clientSocket(new TCPClientSocket(address.c_str(),
+                                                                 port,
+                                                                 &waiter));
+    connect(std::move(clientSocket));
 }
 
Index: src/client/c/hu/varadiistvan/xplra/XPlane.h
===================================================================
--- src/client/c/hu/varadiistvan/xplra/XPlane.h	(revision 107)
+++ src/client/c/hu/varadiistvan/xplra/XPlane.h	(revision 110)
@@ -36,4 +36,5 @@
 
 #include <set>
+#include <memory>
 
 #include <inttypes.h>
@@ -43,5 +44,5 @@
 namespace hu { namespace varadiistvan { namespace scpl { namespace io {
 
-class LocalClientSocket;
+class BufferedStream;
 class DataStream;
 
@@ -69,4 +70,9 @@
 private:
     /**
+     * The default TCP port.
+     */
+    static const unsigned short defaultTCPPort = 0x5852;
+
+    /**
      * Type for the set of multi-dataref buffers.
      */
@@ -79,7 +85,7 @@
 
     /**
-     * The local client socket over which we are communicating with X-Plane.
-     */
-    scpl::io::LocalClientSocket* socket;
+     * The client socket as a stream, over which we are communicating with X-Plane.
+     */
+    scpl::io::BufferedStream* socket;
 
     /**
@@ -108,7 +114,13 @@
 
     /**
-     * Connect to the simulator.
+     * Connect to the simulator locally.
      */
     void connect();
+
+    /**
+     * Connect to the simulator on TCP to the given address.
+     */
+    void connectTCP(const std::string& address,
+                    unsigned short port = defaultTCPPort);
 
     /**
@@ -363,4 +375,10 @@
     void setArray(const char* name, uint8_t type, size_t length,
                   size_t offset);
+
+    /**
+     * Connect with the given socket.
+     */
+    template <class ClientSocket>
+    void connect(std::unique_ptr<ClientSocket> clientSocket);
 
     friend class MultiBuffer;
