Re: [Win2k - Version 8.0.2] - StartupMessage Format Question

From: John DeSoi <desoi(at)pgedit(dot)com>
To: "Tom Pfeifer" <tpfeifer(at)tela(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: [Win2k - Version 8.0.2] - StartupMessage Format Question
Date: 2005-05-15 03:19:36
Message-ID: 5e563e10660f854095cec35614c59793@pgedit.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Sim Zacks 2005-05-15 06:11:32 Re: Fwd: [NOVICE] Autocommit in Postgresql
Previous Message Tom Pfeifer 2005-05-15 02:16:18 Re: [Win2k - Version 8.0.2] - StartupMessage Format Question