Re: [Win2k - Version 8.0.2] - StartupMessage Format Question
От | John DeSoi |
---|---|
Тема | Re: [Win2k - Version 8.0.2] - StartupMessage Format Question |
Дата | |
Msg-id | 5e563e10660f854095cec35614c59793@pgedit.com обсуждение исходный текст |
Ответ на | Re: [Win2k - Version 8.0.2] - StartupMessage Format Question ("Tom Pfeifer" <tpfeifer@tela.com>) |
Список | 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 по дате отправления: