Menu

Problem with DB offset

Help
Ydaki
2007-08-06
2013-05-09
  • Ydaki

    Ydaki - 2007-08-06

        Hy,

      I'have a problem with Delphi and and TCP/IP connexion with a CPU 315-2 PN/DP.

      Connexion is fine and working except when I try to ask data with a offset in the DB.

      When I ask     NoDave.ReadBytes(daveDB, 171, 0, 40);

      Everything is ok, but when I specify an offset like this

                     NoDave.ReadBytes(daveDB, 171, 40, 40);   // to read the 40 next byte.

        Te function return back only errored value.

        Any Idea welcome,

        Kinds Regards,

              Philippe D'Hont.

     
    • Ydaki

      Ydaki - 2007-08-13

            I found why I was getting errored value when an offset was specified.

        For a temporary solution you can modify in the function :

          function TNoDave.BufferAt(Address: Integer; Size: Integer; Buffer: Pointer; BufOffs: Integer; BufLen: Integer): Pointer;

        You can change

      .
      .
      .
          end else begin
            Offset:=Address - FBufOffs;
            If Offset + Size <= FBufLen then Result:=Pointer(Integer(FBuffer) + Offset);
      .
      .
      .
      by
      ..
          end else begin
            Offset:=Address - BufOffs;
            If Offset + Size <= FBufLen then Result:=Pointer(Integer(FBuffer) + Offset);
      .
      .
      .

          Kinds Regards,

                    Philipe D'Hont.

       
    • afk

      afk - 2007-08-27

      The reason is that there was no detection of undefined parameters for BufOffs and BufLen in the Get...-methods.

      In the next version of the component the default-values of these parameters will be -1 instead of 0, and each Get...-method will have this two lines at the beginning:

      If BufOffs = -1 then BufOffs:=FBufOffs;
      If BufLen = -1 then BufLen:=FBufLen;

      Thanks for the Hint !

      Best regards,
      Axel

       

Anonymous
Anonymous

Add attachments
Cancel