diff options
Diffstat (limited to 'libvncserver/sockets.c')
-rw-r--r-- | libvncserver/sockets.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/libvncserver/sockets.c b/libvncserver/sockets.c index d2f814b..a7a829a 100644 --- a/libvncserver/sockets.c +++ b/libvncserver/sockets.c @@ -98,6 +98,8 @@ int deny_severity=LOG_WARNING; #endif #if defined(WIN32) +#include <winsock2.h> +#include <ws2tcpip.h> #ifndef __MINGW32__ #pragma warning (disable: 4018 4761) #endif @@ -109,6 +111,13 @@ int deny_severity=LOG_WARNING; #define closesocket close #endif +#ifdef _MSC_VER +#define SHUT_RD 0x00 +#define SHUT_WR 0x01 +#define SHUT_RDWR 0x02 +#define snprintf _snprintf /* Missing in MSVC */ +#endif + int rfbMaxClientWait = 20000; /* time (ms) after which we decide client has gone away - needed to stop us hanging */ @@ -451,11 +460,13 @@ rfbProcessNewConnection(rfbScreenInfoPtr rfbScreen) #endif #ifdef LIBVNCSERVER_IPv6 - char host[1024]; - if(getnameinfo((struct sockaddr*)&addr, addrlen, host, sizeof(host), NULL, 0, NI_NUMERICHOST) != 0) { - rfbLogPerror("rfbProcessNewConnection: error in getnameinfo"); + { + char host[1024]; + if(getnameinfo((struct sockaddr*)&addr, addrlen, host, sizeof(host), NULL, 0, NI_NUMERICHOST) != 0) { + rfbLogPerror("rfbProcessNewConnection: error in getnameinfo"); + } + rfbLog("Got connection from client %s\n", host); } - rfbLog("Got connection from client %s\n", host); #else rfbLog("Got connection from client %s\n", inet_ntoa(addr.sin_addr)); #endif |