Add support for Unix sockets
Patch originally by Dag-Erling Smørgrav for University of Oslo.
diff --git a/vncviewer/CConn.cxx b/vncviewer/CConn.cxx
index 35d6e23..166597e 100644
--- a/vncviewer/CConn.cxx
+++ b/vncviewer/CConn.cxx
@@ -39,6 +39,9 @@
#include <rdr/MemInStream.h>
#include <rdr/MemOutStream.h>
#include <network/TcpSocket.h>
+#ifndef WIN32
+#include <network/UnixSocket.h>
+#endif
#include <FL/Fl.H>
#include <FL/fl_ask.H>
@@ -106,10 +109,19 @@
if(sock == NULL) {
try {
- getHostAndPort(vncServerName, &serverHost, &serverPort);
+#ifndef WIN32
+ if (strchr(vncServerName, '/') != NULL) {
+ sock = new network::UnixSocket(vncServerName);
+ serverHost = sock->getPeerAddress();
+ vlog.info(_("connected to socket %s"), serverHost);
+ } else
+#endif
+ {
+ getHostAndPort(vncServerName, &serverHost, &serverPort);
- sock = new network::TcpSocket(serverHost, serverPort);
- vlog.info(_("connected to host %s port %d"), serverHost, serverPort);
+ sock = new network::TcpSocket(serverHost, serverPort);
+ vlog.info(_("connected to host %s port %d"), serverHost, serverPort);
+ }
} catch (rdr::Exception& e) {
vlog.error("%s", e.str());
if (alertOnFatalError)