First thank you so much for your time and explanation, and sorry I didn't explain more,
All I'm trying to do send screenshot to the server (admin) , I can't use FTP or HTTP, I'm trying to do screen share program kind of RDP.
I thought if I understand how to send image I will do the rest, as I have code on how to capture scree and save to the MemStream
Now I understand your point,
I guess you mea something like this:
Client side: (Sender)
fstream := TMemoryStream.Create;
try
WSocket1.SendStr(inttostr(fstream.Size));
wsocket1.Send(fstream.Memory, fstream.Size);
finally
fstream.Free;
end;
Server (Receiver), as you said, I guess I have problem below.
procedure TTcpSrvForm.ClientDataAvailable(
Sender : TObject;
Error : Word);
var
MyStream: TMemoryStream;
Buf : array [0..1024] of AnsiChar;
Len : Integer;
begin
Len := TCustomLineWSocket(Sender).Receive(@Buf, Sizeof(Buf) - 1);
if Len <= 0 then
Exit;
Buf[Len] := #0;
MyStream := TMemoryStream.Create;
MyStream.WriteBuffer(Buf, Len);
end;
Thank you for any advice or suggestion.