diff options
author | Vic Lee <[email protected]> | 2010-06-29 20:51:08 +0800 |
---|---|---|
committer | Johannes Schindelin <[email protected]> | 2010-07-08 10:06:17 +0200 |
commit | 68e7696a27b31034876f594f242a229ff2b74fa4 (patch) | |
tree | af218ea7055af0f06098cb3a1a89bc32f231cc33 /libvncclient/rfbproto.c | |
parent | f76c81941a001bde59a9c4df5445569d2134ab5b (diff) | |
download | libtdevnc-68e7696a27b31034876f594f242a229ff2b74fa4.tar.gz libtdevnc-68e7696a27b31034876f594f242a229ff2b74fa4.zip |
libvncclient: add ipv6 support
[jes: pulled the "host" declarations into the conditionally compiled
blocks where that variable is used. Also fixed non-IPv6 connections.]
Signed-off-by: Vic Lee <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
Diffstat (limited to 'libvncclient/rfbproto.c')
-rw-r--r-- | libvncclient/rfbproto.c | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/libvncclient/rfbproto.c b/libvncclient/rfbproto.c index 33307d2..83ba3a5 100644 --- a/libvncclient/rfbproto.c +++ b/libvncclient/rfbproto.c @@ -363,8 +363,6 @@ IsUnixSocket(const char *name) rfbBool ConnectToRFBServer(rfbClient* client,const char *hostname, int port) { - unsigned int host; - if (client->serverPort==-1) { /* serverHost is a file recorded by vncrec. */ const char* magic="vncLog0.0"; @@ -399,12 +397,20 @@ ConnectToRFBServer(rfbClient* client,const char *hostname, int port) else #endif { - /* serverHost is a hostname */ - if (!StringToIPAddr(hostname, &host)) { - rfbClientLog("Couldn't convert '%s' to host address\n", hostname); - return FALSE; +#ifdef LIBVNCSERVER_IPv6 + client->sock = ConnectClientToTcpAddr6(hostname, port); + if (client->sock == -1) +#endif + { + unsigned int host; + + /* serverHost is a hostname */ + if (!StringToIPAddr(hostname, &host)) { + rfbClientLog("Couldn't convert '%s' to host address\n", hostname); + return FALSE; + } + client->sock = ConnectClientToTcpAddr(host, port); } - client->sock = ConnectClientToTcpAddr(host, port); } if (client->sock < 0) { @@ -421,17 +427,23 @@ ConnectToRFBServer(rfbClient* client,const char *hostname, int port) rfbBool ConnectToRFBRepeater(rfbClient* client,const char *repeaterHost, int repeaterPort, const char *destHost, int destPort) { - unsigned int host; rfbProtocolVersionMsg pv; int major,minor; char tmphost[250]; - if (!StringToIPAddr(repeaterHost, &host)) { - rfbClientLog("Couldn't convert '%s' to host address\n", repeaterHost); - return FALSE; - } +#ifdef LIBVNCSERVER_IPv6 + client->sock = ConnectClientToTcpAddr6(repeaterHost, repeaterPort); + if (client->sock == -1) +#endif + { + unsigned int host; + if (!StringToIPAddr(repeaterHost, &host)) { + rfbClientLog("Couldn't convert '%s' to host address\n", repeaterHost); + return FALSE; + } - client->sock = ConnectClientToTcpAddr(host, repeaterPort); + client->sock = ConnectClientToTcpAddr(host, repeaterPort); + } if (client->sock < 0) { rfbClientLog("Unable to connect to VNC repeater\n"); |