Index: src/xplcommon/posix/LocalClientSocket.cc
===================================================================
--- src/xplcommon/posix/LocalClientSocket.cc	(revision 15)
+++ src/xplcommon/posix/LocalClientSocket.cc	(revision 15)
@@ -0,0 +1,114 @@
+// Copyright (c) 2012 by István Váradi
+
+// This file is part of libxplcommon, a common utility library for
+// development related to 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 "LocalClientSocket.h"
+
+#include "Connector.h"
+#include "LocalServerSocket.h"
+
+#include <sys/socket.h>
+
+//------------------------------------------------------------------------------
+
+using xplcommon::posix::LocalClientSocket;
+using xplcommon::posix::Connector;
+
+//------------------------------------------------------------------------------
+
+/**
+ * The connector class used by the local client.
+ */
+class LocalClientSocket::LocalConnector : public Connector
+{
+private:
+    /**
+     * The reference to the corresponding socket's address.
+     */
+    const struct sockaddr_un& address;
+
+public:
+    /**
+     * Create the connector for the given local client socket.
+     */
+    LocalConnector(LocalClientSocket* socket);
+
+protected:
+    /**
+     * Get the address.
+     */
+    virtual const struct sockaddr* getAddress(size_t& addrlen);
+};
+
+//------------------------------------------------------------------------------
+
+inline
+LocalClientSocket::LocalConnector::LocalConnector(LocalClientSocket* socket) :
+    Connector(socket),
+    address(socket->sun)
+{
+}
+
+//------------------------------------------------------------------------------
+
+const struct sockaddr*
+LocalClientSocket::LocalConnector::getAddress(size_t& addrlen)
+{
+    addrlen = sizeof(address);
+    return reinterpret_cast<const struct sockaddr*>(&address);
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+LocalClientSocket::LocalClientSocket(const char* name, Waiter* waiter,
+                                     size_t readingCapacity,
+                                     size_t writingCapacity) :
+    ClientSocket(AF_UNIX, SOCK_STREAM, waiter, 0,
+                 readingCapacity, writingCapacity)
+{
+    sun.sun_family = AF_UNIX;
+    LocalServerSocket::setupPath(sun, name);
+}
+
+//------------------------------------------------------------------------------
+
+Connector* LocalClientSocket::createConnector()
+{
+    return new LocalConnector(this);
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/xplcommon/posix/LocalClientSocket.h
===================================================================
--- src/xplcommon/posix/LocalClientSocket.h	(revision 15)
+++ src/xplcommon/posix/LocalClientSocket.h	(revision 15)
@@ -0,0 +1,98 @@
+// Copyright (c) 2012 by István Váradi
+
+// This file is part of libxplcommon, a common utility library for
+// development related to 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.
+
+#ifndef XPLCOMMON_POSIX_LOCALCLIENTSOCKET_H
+#define XPLCOMMON_POSIX_LOCALCLIENTSOCKET_H
+//------------------------------------------------------------------------------
+
+#include "ClientSocket.h"
+
+#include <sys/un.h>
+
+//------------------------------------------------------------------------------
+
+namespace xplcommon { namespace posix {
+
+//------------------------------------------------------------------------------
+
+/**
+ * Client socket that connects to a server socket locally (i.e. a Unit
+ * socket).
+ *
+ * The server socket's name should be given. The name will be used as
+ * described for LocalServerSocket.
+ */
+class LocalClientSocket : public ClientSocket
+{
+private:
+    /**
+     * The connector class.
+     */
+    class LocalConnector;
+
+    /**
+     * The address to use for connecting.
+     */
+    struct sockaddr_un sun;
+
+public:
+    /**
+     * Construct the client socket with the given name.
+     *
+     * @param waiter the waiter to use for waiting a possible event
+     * occuring on the socket. If given, the socket will be
+     * non-blocking. Otherwise, it will be blocking, and the connect()
+     * function of the Connector might block as well as the reading
+     * and writing buffers.
+     */
+    LocalClientSocket(const char* name, Waiter* waiter = 0,
+                      size_t readingCapacity = DEFAULT_CAPACITY,
+                      size_t writingCapacity = DEFAULT_CAPACITY);
+
+protected:
+    /**
+     * Create a new connector of the correct type.
+     */
+    virtual Connector* createConnector();
+
+    friend class LocalConnector;
+};
+
+//------------------------------------------------------------------------------
+
+} /* namespace xplcommon::posix */ } /* namespace xplcommon */
+
+//------------------------------------------------------------------------------
+#endif // XPLCOMMON_POSIX_LOCALCLIENTSOCKET_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/xplcommon/posix/LocalServerSocket.h
===================================================================
--- src/xplcommon/posix/LocalServerSocket.h	(revision 14)
+++ src/xplcommon/posix/LocalServerSocket.h	(revision 15)
@@ -52,5 +52,5 @@
 class LocalServerSocket : public ServerSocket
 {
-private:
+public:
     /**
      * Fill in the path of the socket with the given name.
@@ -58,4 +58,5 @@
     static void setupPath(struct sockaddr_un& addr, const char* name);
 
+private:
     /**
      * Our address (to be used when deleting the file in the
Index: src/xplcommon/posix/Makefile.am
===================================================================
--- src/xplcommon/posix/Makefile.am	(revision 11)
+++ src/xplcommon/posix/Makefile.am	(revision 15)
@@ -14,5 +14,6 @@
 	Connector.cc		\
 	ClientSocket.cc		\
-	LocalServerSocket.cc
+	LocalServerSocket.cc	\
+	LocalClientSocket.cc
 
 include_xplcommon_posixdir=$(includedir)/xplcommon/posix
@@ -33,3 +34,4 @@
 	LocalSocket.h		\
 	LocalAcceptor.h		\
-	LocalServerSocket.h
+	LocalServerSocket.h	\
+	LocalClientSocket.h
