Skip site navigation (1) Skip section navigation (2)

Re: BUG: Protocol 3.0: that's just odd, needing to add the number of bytes the length field occupies

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Eugen(dot)Konkov(at)aldec(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG: Protocol 3.0: that's just odd, needing to add the number of bytes the length field occupies
Date: 2008-04-16 16:46:44
Message-ID: 200804161646.m3GGkiV13746@momjian.us (view raw or flat)
Thread:
Lists: pgsql-bugs
Eugen(dot)Konkov(at)aldec(dot)com wrote:
> server side: writeInt32(  length($message)+4 ); writeString( $message );
> client side: $length= readInt32(); readString( $length -4 )
> 
> that's just odd, needing to add the number of bytes the length field occupies
> 
> This is simpler:
> server side: writeInt32(  length($message)); writeString( $message );
> client side: $length= readInt32(); readString( $length )
> 
> Will you plan to correct that in Protocol 3.1?

Agreed, no plans to change that.  TCP does the same:

      http://www.ysn.ru/docs/cie/Course/Section4/8.htm

                     +--------+--------+--------+--------+
                     |           Source Address          |
                     +--------+--------+--------+--------+
                     |         Destination Address       |
                     +--------+--------+--------+--------+
                     |  zero  |  PTCL  |    TCP Length   |
                     +--------+--------+--------+--------+

      The TCP Length is the TCP header length plus the data length in
                            -----------------
      octets (this is not an explicitly transmitted quantity, but is
      computed), and it does not count the 12 octets of the pseudo
      header.


-- 
  Bruce Momjian  <bruce(at)momjian(dot)us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

In response to

pgsql-bugs by date

Next:From: Fujii MasaoDate: 2008-04-17 04:39:38
Subject: Re: BUG #4109: Typo in documentation
Previous:From: Tom LaneDate: 2008-04-16 15:35:05
Subject: Re: BUG: Protocol 3.0: that's just odd, needing to add the number of bytes the length field occupies

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group