On May 14, 2005, at 10:16 PM, Tom Pfeifer wrote:
> I must be missing something else.
> Am I calculating the string length correctly?
> Is the length/version/revision/string being packed correctly?
> Maybe my pack statement is all wrong?
> Any help would be much appreciated.
I don't know perl, so it is hard for me to check your work. The string
you are building looks correct:
$string = 'user' . chr(0) . 'postgres' . chr(0) . 'database' . chr(0) .
'maach' . chr(0) . chr(0);
So the length of message should be = 4 + 4 + length($string)
That's 4 bytes for the message length, 4 bytes for the protocol
version, and then the length of the string including the null bytes.
So write the total length, protocol version, and then your connect
string. Any integer you write (Int16 and Int32 in the protocol) needs
to be in network byte order (most significant byte first).
John DeSoi, Ph.D.
Power Tools for PostgreSQL
In response to
pgsql-novice by date
|Next:||From: Sim Zacks||Date: 2005-05-15 06:11:32|
|Subject: Re: Fwd: [NOVICE] Autocommit in Postgresql|
|Previous:||From: Tom Pfeifer||Date: 2005-05-15 02:16:18|
|Subject: Re: [Win2k - Version 8.0.2] - StartupMessage Format Question|