Sì sono applicazioni differenti.
codice:
type
TCommand = packed record
cmd : string[10];
opt : string[100];
data: TList;
end;
TRubrica = class(TObject)
id : integer;
Nome,
Cognome: string[15];
Azienda: string[30];
NumTel,
NumCell: string[20];
Email,
Notes : string[30];
end;
Questi due tipi sono, ovviamente, comuni ad entrambi i software.
Quando il server riceve il comando esegue questo codice:
codice:
//r è di tipo TRubrica
q.SQL.Text := 'SELECT id,nome,cognome,azienda,ufficioD,cellulareD,email,note FROM contatti WHERE cognome LIKE ''%'+comando.opt+''' ORDER BY cognome, nome LIMIT 20';
try
q.Open;
comando.data := TList.Create;
r.create;
while not q.Eof do
begin
r.id := q.FieldByName('id').AsInteger;
// e tutti gli altri campi
comando.data.Add(r);
q.Next;
end;
q.Close;
except on e:exception do WriteLog('Errore ricerca contatto: '+e.Message);
end;
end;
AThread.Connection.WriteInteger(sizeof(comando));
AThread.Connection.OpenWriteBuffer;
AThread.Connection.WriteBuffer(comando,sizeof(comando));
AThread.Connection.CloseWriteBuffer;
Quando poi il client riceve il comando tenta di accedere alla lista normalmente (comando.data.Count). Ma mi dà errore di "Access violation".