Very wierd problem

Giganews Newsgroups
Subject: Very wierd problem
Posted by:  Feij√≥ (fei…
Date: Tue, 25 Apr 2006

I built a simple UDP send/recieve program, just few lines of code.  Works
perfect in a demo project.
When I copy this code to my final app., delphi dont compile!

[Error] dmIndy.pas(15): Undeclared identifier: 'TBytes'

I added:

TBytes = array of Byte;

Now, he give this error:

[Error] dmIndy.pas(56): Undeclared identifier: 'BytesToString'

Then I try to assemble that function copying from IdGlobal

function BytesToString(ABytes: TBytes): String;
var AStartIndex, AMaxCount: Integer;
  AStartIndex := 0;
  AMaxCount := 5000;
  AMaxCount := Min(Length(ABytes) - AStartIndex, AMaxCount);
  SetLength(Result, AMaxCount);
  if AMaxCount > 0 then
    Move(ABytes[AStartIndex], Result[1], AMaxCount);

Now it compile, but the return from UDPRead is always "40B"

My uses:

  SysUtils, Classes, IdUDPClient, IdBaseComponent, IdComponent, IdUDPBase,
  IdUDPServer, IdSocketHandle, IdGlobal, IdStack;

Can't find anything wrong!!!