I'm having a problem with asynchronous connections, and I can't seem to find
a good example of this anywhere. To make things simple, I've reduced my
program to the bare minimums, not even using select(). Here's my program
flow:
1. Call PQconnectStart. I'm told CONNECTION_STARTED.
2. Sleeping 300ms in between calls, call PQconnectPoll.
The FIRST time I call this I'm told CONNECTION_STARTED and
PGRES_POLLING_WRITING. Every additional time I call this I'm told
CONNECTION_SSL_STARTUP and PGRES_POLLING_READING. It never leaves this state,
and goes on in an infinite loop until I kill the attempt.
In my Postgres logs I see: LOG: incomplete startup packet
If I PQtrace the connection I see:
To backend> Msg
To backend> <binary junk>
To backend> Msg complete, length 8
What could be going on? Incidentally, the only thing I found that comes close
is a pg_ping tool posted by another user, and that does the same thing. Yet
psql works fine using the same connection parameters, and if I rewrite my
program to use blocking functions, it works too.
This is with Postgres 8.0.1 using TCP/IP connections over a local LAN.
Thanks,
Chad
__________________________________
Do you Yahoo!?
Take Yahoo! Mail with you! Get it on your mobile phone.
http://mobile.yahoo.com/maildemo