Re: [Win2k - Version 8.0.2] - StartupMessage Format Question - Mailing list pgsql-novice

From John DeSoi
Subject Re: [Win2k - Version 8.0.2] - StartupMessage Format Question
Date
Msg-id 5e563e10660f854095cec35614c59793@pgedit.com
Whole thread Raw
In response to Re: [Win2k - Version 8.0.2] - StartupMessage Format Question  ("Tom Pfeifer" <tpfeifer@tela.com>)
List pgsql-novice
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.
http://pgedit.com/
Power Tools for PostgreSQL


pgsql-novice by date:

Previous
From: "Tom Pfeifer"
Date:
Subject: Re: [Win2k - Version 8.0.2] - StartupMessage Format Question
Next
From: "Tom Pfeifer"
Date:
Subject: Fw: Re: [Win2k - Version 8.0.2] - StartupMessage Format Question