[freetds] tds_connect() bails on win32

James Vanns jimv at canterbury.ac.uk
Mon Aug 16 07:26:05 EDT 2004


Thanks guys! The patch works IF you replace 

#define TDSSOCK_EINPROGRESS WSAEINPROGRESS

with

#define TDSSOCK_EINPROGRESS WSAEWOULDBLOCK

note the inclusion of the 'E' which was not in the submitted patch.
Typo? Or is my system just weird! Cheers again! Great work. 

Regards

Jim

On Fri, 2004-08-13 at 16:19, ZIGLIO, Frediano, VF-IT wrote:
> > 
> > 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
> _______________________________________________
> FreeTDS mailing list
> FreeTDS at lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds
-- 
James Vanns BSc (Hons) MCP
Senior Software Engineer (Linux / C & C++)
Canterbury Christ Church University College
Public Key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x24045370





More information about the FreeTDS mailing list