hi,
ich hab mir mal eine procedure gemacht womit ich strings in array umwandele und dann via
indy tcp-stream verschicke blos da is iwie ein fehler blos wo?
client:
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
fsIN:tMemoryStream ;
a_s_in:
array[0..1000]
of string;
sl_in:tstringlist;
i:integer;
s_ss:tstringstream;
begin
sl_in:=tstringlist.create;
sl_in.add('
a');
sl_in.add('
b');
for I := 0
to sl_in.count - 1
do
begin
a_s_in[i]:=sl_in[i];
end;
fsIN:=tMemoryStream.Create;
try
fsin.
Read(a_s_in,sizeof(a_s_in));
FreeAndNil(fsIN);
except
exit;
end;
IdTCPClient1.Connect;
IdTCPClient1.IOHandler.
Write(fsin);
// hier is der fehler: Access violation at address 00461AD2 in module "Project1.exe" read od address 00000000
IdTCPClient1.Disconnect;
end;
server:
Delphi-Quellcode:
procedure TForm1.IdTCPServer1Execute(AContext: TIdContext);
var
fsOUT:tMemoryStream ;
a_s_out:array[0..1000] of string;
sl_out:tstringlist;
i:integer;
con:boolean;
begin
fsout:=tMemoryStream.Create;
sl_out:=tstringlist.create;
while (con=true) do
begin
acontext.Connection.IOHandler.ReadStream(fsOUT);
end;
fsout.Write(a_s_out,sizeof(a_s_out));
i:=-1;
try
while (i<1000) do
begin
i:=i+1;
if (a_s_out[i]<>'') then
begin
sl_out.Add(a_s_out[i]);
end;
end;
except
exit;
end;
listbox1.items:=sl_out;
end;