L
leadyli
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.ServerSocket1ClientRead(Sender: TObject;
Socket: TCustomWinSocket);
var
Buf: array [0..60000] of byte;
ln: LongInt;
Str: TMemoryStream;
bmp: TBitmap;
tit: array [0..3] of char;
text: string;
begin
str := TMemoryStream.Create;
ln := Socket.ReceiveLength;
Socket.ReceiveBuf(tit,4);
if tit = 'bmp:' then
begin
Socket.ReceiveBuf(Buf,ln-4);
Str.WriteBuffer(Buf,ln-4);
bmp := TBitmap.Create;
Str.Position := 0;
bmp.LoadFromStream(Str);
Image1.Picture.Bitmap.Assign(bmp);
Image1.Picture.SaveToFile('E:/1.bmp');
Socket.SendText('已接收');
end else
if tit = 'meo:' then
begin
text := Socket.ReceiveText;
Memo1.Lines.Add(Socket.RemoteAddress + ':' + Text);
Socket.SendText('已接收');
end;
end;
如題!我的Email: leadyli@163.com
Socket: TCustomWinSocket);
var
Buf: array [0..60000] of byte;
ln: LongInt;
Str: TMemoryStream;
bmp: TBitmap;
tit: array [0..3] of char;
text: string;
begin
str := TMemoryStream.Create;
ln := Socket.ReceiveLength;
Socket.ReceiveBuf(tit,4);
if tit = 'bmp:' then
begin
Socket.ReceiveBuf(Buf,ln-4);
Str.WriteBuffer(Buf,ln-4);
bmp := TBitmap.Create;
Str.Position := 0;
bmp.LoadFromStream(Str);
Image1.Picture.Bitmap.Assign(bmp);
Image1.Picture.SaveToFile('E:/1.bmp');
Socket.SendText('已接收');
end else
if tit = 'meo:' then
begin
text := Socket.ReceiveText;
Memo1.Lines.Add(Socket.RemoteAddress + ':' + Text);
Socket.SendText('已接收');
end;
end;
如題!我的Email: leadyli@163.com