Skip site navigation (1) Skip section navigation (2)

RE: [INTERFACES] libpq sockets on win32

From: "Jeff Johnson" <jeff(at)jeffjohnson(dot)net>
To: "'Bruce Momjian'" <pgman(at)candle(dot)pha(dot)pa(dot)us>, <jeff(at)jeffjohnson(dot)net>
Cc: <pgsql-interfaces(at)postgresql(dot)org>, <pgsql-docs(at)postgresql(dot)org>
Subject: RE: [INTERFACES] libpq sockets on win32
Date: 2001-06-04 20:25:05
Message-ID: B9C9130B5D27D4119D5D00A0C9D3A987109461@SERVER (view raw or flat)
Thread:
Lists: pgsql-docspgsql-interfaces
I found this in WinSock.h ... it might shed some light on the problem.


#define WSABASEERR              10000
[snip]

/*
 * Windows Sockets definitions of regular Berkeley error constants
 */
#define WSAEWOULDBLOCK          (WSABASEERR+35)
#define WSAEINPROGRESS          (WSABASEERR+36)



> -----Original Message-----
> From: Bruce Momjian [mailto:pgman(at)candle(dot)pha(dot)pa(dot)us]
> Sent: Monday, June 04, 2001 4:02 PM
> To: jeff(at)jeffjohnson(dot)net
> Cc: pgsql-interfaces(at)postgresql(dot)org; pgsql-docs(at)postgresql(dot)org
> Subject: Re: [INTERFACES] libpq sockets on win32
>
>
> > > I have done exactly that.  I assume fcntl(), ioctl(),
> > > select() use errno
> > > even if used on a socket, while getsockopt(), setsockopt(),
> > socket(),
> > > connect(), getsockname(), send(), recv() use WSAGetLastError.
Is
> > this
> > > list correct?
> >
> > I don't know enough about such things.
>
> The web page wasn't clear about that.
>
> > >
> > > The patch is attached.  Please let me know so I can
> finalize it and
> > > apply it.
> >
> > Couple of changes required to compile on Win32:
> >
> > Change:
> > #define sockerrno WSAGetLastError
> > To:
> > #define sockerrno WSAGetLastError()
> >
>
> OK.
>
> >
> > This has to go back into fe-connect.c, EINPROGRESS isn't defined
in
> > Win32 for some reason..
> > #ifndef WIN32
> > 		if (errno == EINPROGRESS || errno == 0)
> > #else
> > 		if (WSAGetLastError() == WSAEINPROGRESS)
> > #endif
> >
>
> OK.  Not sure why it wasn't defined, but, oh well.
>
> >
> >
> > I tested it out but I'm getting this error when sending a large
SQL
> > statement (>16k).
> >     cu.execute(sql)
> >   File "c:\python20\pgdb.py", line 189, in execute
> >     self.executemany(operation, (params,))
> >   File "c:\python20\pgdb.py", line 204, in executemany
> >     rows = self.__source.execute(sql)
> > ValueError: pqReadData() --  read() failed: errno=10035
> > Unknown error
>
> That errno is very high, 10035.  If I take a look at my sys/errno.h
on
> BSD/OS, I see:
>
> 	#define EAGAIN      35      /* Resource temporarily
> unavailable */
>
> so my guess is that WSAGetLastError() returns errno plus 10,000.
What
> value does your include file set for EAGAIN, 10035 or 35.  If
> it is 35,
> the following patch may work.  It has all your suggested fixes.
>
> --
>   Bruce Momjian                        |  http://candle.pha.pa.us
>   pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 853-3000
>   +  If your life is a hard drive,     |  830 Blythe Avenue
>   +  Christ can be your backup.        |  Drexel Hill,
> Pennsylvania 19026
>


Responses

pgsql-docs by date

Next:From: Bruce MomjianDate: 2001-06-04 20:35:08
Subject: Re: [INTERFACES] libpq sockets on win32
Previous:From: Bruce MomjianDate: 2001-06-04 20:02:00
Subject: Re: [INTERFACES] libpq sockets on win32

pgsql-interfaces by date

Next:From: Bruce MomjianDate: 2001-06-04 20:35:08
Subject: Re: [INTERFACES] libpq sockets on win32
Previous:From: Bruce MomjianDate: 2001-06-04 20:02:00
Subject: Re: [INTERFACES] libpq sockets on win32

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group