Q
qegdgh49410436
Unregistered / Unconfirmed
GUEST, unregistred user!
//接收信息
procedure TForm1.IdUDPServer1UDPRead(Sender: TObject; AData: TStream;
ABinding: TIdSocketHandle);
var
DataMemoryStream: TMemoryStream;
MessageString:String;
buffer:array of char;
begin
DataMemoryStream := TMemoryStream.Create;
DataMemoryStream.LoadFromStream(AData);
SetLength(buffer,AData.size);
AData.Read(buffer,AData.Size);
//DataMemoryStream.Read(Buffer,AData.Size);
MessageString := String(buffer);
showmessage(MessageString);
DataMemoryStream.Free;
end;
//发送信息
procedure TForm1.Button1Click(Sender: TObject);
begin
IdUDPClient1.Send(memo1.Lines.Text);
end;
请问怎接收到的信息是空符串呢;用TStringStream则是可以正常读取到的;但VOD视机产家说得以读取二进制的方式来读取,我不是很理解,希望各位高手指点一二.
procedure TForm1.IdUDPServer1UDPRead(Sender: TObject; AData: TStream;
ABinding: TIdSocketHandle);
var
DataMemoryStream: TMemoryStream;
MessageString:String;
buffer:array of char;
begin
DataMemoryStream := TMemoryStream.Create;
DataMemoryStream.LoadFromStream(AData);
SetLength(buffer,AData.size);
AData.Read(buffer,AData.Size);
//DataMemoryStream.Read(Buffer,AData.Size);
MessageString := String(buffer);
showmessage(MessageString);
DataMemoryStream.Free;
end;
//发送信息
procedure TForm1.Button1Click(Sender: TObject);
begin
IdUDPClient1.Send(memo1.Lines.Text);
end;
请问怎接收到的信息是空符串呢;用TStringStream则是可以正常读取到的;但VOD视机产家说得以读取二进制的方式来读取,我不是很理解,希望各位高手指点一二.