pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Problem when I'm using libpq PQconnectdb function
3+ messages / 3 participants
[nested] [flat]

* Problem when I'm using libpq PQconnectdb function
@ 2004-02-11 22:21  Daniel Gerardo Lucero Baylon <daniel_baylon@yahoo.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Daniel Gerardo Lucero Baylon @ 2004-02-11 22:21 UTC (permalink / raw)
  To: pgsql-interfaces

I compile a C program which uses libpq on Win 32.

When call PQconnectdb function and retrieves error message (PQerrorMessage),
this is error function returns:

"could not create socket: WSAStartup not yet called (0x0000276D/10093)"

I don't know what error means.

I appreciate some help.

Best Regards.

__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Problem when I'm using libpq PQconnectdb function
@ 2004-02-11 22:52  Jeroen T. Vermeulen <jtv@xs4all.nl>
  parent: Daniel Gerardo Lucero Baylon <daniel_baylon@yahoo.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Jeroen T. Vermeulen @ 2004-02-11 22:52 UTC (permalink / raw)
  To: Daniel Gerardo Lucero Baylon <daniel_baylon@yahoo.com>; +Cc: pgsql-interfaces

On Wed, Feb 11, 2004 at 02:21:50PM -0800, Daniel Gerardo Lucero Baylon wrote:
> I compile a C program which uses libpq on Win 32.
> 
> When call PQconnectdb function and retrieves error message (PQerrorMessage),
> this is error function returns:
> 
> "could not create socket: WSAStartup not yet called (0x0000276D/10093)"
> 
> I don't know what error means.

The error means that WSAStartup has not yet been called.  And that means
that you must call WSAStartup before you try to create a socket.  That's
what the message says.  It's a Windows-specific problem that doesn't exist
on other systems.

These are generic C/C++/Windows programming problems, so this is not really
the right place to bring them up...


Jeroen




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Problem when I'm using libpq PQconnectdb function
@ 2004-05-27 08:03  Magnus Hagander <mha@sollentuna.net>
  0 siblings, 0 replies; 3+ messages in thread

From: Magnus Hagander @ 2004-05-27 08:03 UTC (permalink / raw)
  To: Daniel Gerardo Lucero Baylon <daniel_baylon@yahoo.com>; pgsql-interfaces

> I compile a C program which uses libpq on Win 32.
> 
> When call PQconnectdb function and retrieves error message 
> (PQerrorMessage), this is error function returns:
> 
> "could not create socket: WSAStartup not yet called 
> (0x0000276D/10093)"
> 
> I don't know what error means.
> 
> I appreciate some help.

If you use the libpqdll importl ibrary (and thus dynamically link to
libpq.dll instead of the static library), it should get called
automatically for you.
Or if you want to use the static library, your program needs to call
WSAStartup() before it uses any libpq functions. This is rqeuired for
all win32 applications that need to use the windwos sockets API. 
You can find information about how to call the function at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock
/winsock/wsastartup_2.asp


//Magnus



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2004-05-27 08:03 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-02-11 22:21 Problem when I'm using libpq PQconnectdb function Daniel Gerardo Lucero Baylon <daniel_baylon@yahoo.com>
2004-02-11 22:52 ` Jeroen T. Vermeulen <jtv@xs4all.nl>
2004-05-27 08:03 Re: Problem when I'm using libpq PQconnectdb function Magnus Hagander <mha@sollentuna.net>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox