[freetds] tds_connect() bails on win32

ZIGLIO, Frediano, VF-IT Frediano.Ziglio at vodafone.com
Fri Aug 13 11:19:11 EDT 2004


> 
> All,
> 
> When trying to connect to a SQL Server machine on Linux with 
> FreeTDS all
> is well. However, when trying to connect to the same machine using a
> win32 client it bails.
> 
> I compiled the FreeTDS library (DLL) etc. but when trying to 
> connect it
> spits this out:
> 
> src/tds/login.c: tds_connect (timed): Invalid argument.
> 
> And in the dump file the point it gets to is:
> 
> Connecting to <IP Address> on port <Port>, TDS <Version>.
> 
> When doing a few tests I can confirm that it bails at this 
> point in the
> TDS source (login.c:334):
> 
> retval = connect (tds->s, (struct sockaddr *) &sin, sizeof (sin));
> ...
> if (retval < 0)
> ...
> 
> However, I don't know why! Any ideas?
> 
> Regards
> 
> Jim
> 

Try this patch

diff -u -1 -0 -r1.13 tds_sysdep_private.h
--- include/tds_sysdep_private.h        2 May 2004 07:30:40 -0000
1.13
+++ include/tds_sysdep_private.h        13 Aug 2004 15:18:19 -0000
@@ -37,21 +37,21 @@

 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
 #include <windows.h>
 #define READSOCKET(a,b,c)      recv((a), (b), (c), 0L)
 #define WRITESOCKET(a,b,c)     send((a), (b), (c), 0L)
 #define CLOSESOCKET(a)         closesocket((a))
 #define IOCTLSOCKET(a,b,c)     ioctlsocket((a), (b), (c))
 #define NETDB_REENTRANT 1      /* BSD-style netdb interface is
reentrant */

 #define TDSSOCK_EINTR WSAEINTR
-#define TDSSOCK_EINPROGRESS WSAEINPROGRESS
+#define TDSSOCK_EINPROGRESS WSAWOULDBLOCK
 #define getpid() GetCurrentThreadId()
 #define sock_errno WSAGetLastError()
 #ifndef __MINGW32__
 typedef DWORD pid_t;
 #endif
 #define strcasecmp stricmp
 #define strncasecmp strnicmp
 #define atoll _atoi64
 #define vsnprintf _vsnprintf

freddy77



More information about the FreeTDS mailing list