8
860
Unregistered / Unconfirmed
GUEST, unregistred user!
服务端可以接收到文字,但接收不到图片,在线等待急......请大虾指点,给出答案再给分.
客户端:
procedure TForm1.Button1Click(Sender: TObject);
begin
IdUDPClient1.Send(RxRichEdit1.Text);
end;
服务端:
procedure TForm1.IdUDPServer1UDPRead(Sender: TObject; AData: TStream;
ABinding: TIdSocketHandle);
var
DataStringStream: TStringStream;
begin
DataStringStream := TStringStream.Create('');
try
DataStringStream.CopyFrom(AData, AData.Size);
RxRichEdit1.Lines.Add(DataStringStream.DataString);
finally
DataStringStream.Free;
end;
end;
客户端:
procedure TForm1.Button1Click(Sender: TObject);
begin
IdUDPClient1.Send(RxRichEdit1.Text);
end;
服务端:
procedure TForm1.IdUDPServer1UDPRead(Sender: TObject; AData: TStream;
ABinding: TIdSocketHandle);
var
DataStringStream: TStringStream;
begin
DataStringStream := TStringStream.Create('');
try
DataStringStream.CopyFrom(AData, AData.Size);
RxRichEdit1.Lines.Add(DataStringStream.DataString);
finally
DataStringStream.Free;
end;
end;