这样写不对吗?(50分)

  • 主题发起人 主题发起人 meilixueshan200
  • 开始时间 开始时间
不是userBlock.m_stream.Size?
那是什么?
 
要分二次读,因为是分二次发的
AThread.Connection.InputBuffer
 
拜托楼上大哥
能不能写的具体一点
我不会呀
 
TMyBlock=record
m_username:string[16];
 SendToName:string[16];
end;

procedure TClientForm.GrabberBuffer(sender: TObject; SampleTime: Double; pBuffer: Pointer; BufferLen: Integer);
var
Stream: TStream;
MyBlock:TMyBlock;
begin
Stream:=TStream.Create;
MyBlock.m_username:='brucelee';
try
if VideoWindow.VMRGetBitmap(Stream) then image.Picture.Bitmap.LoadFromStream(Stream);
Grabber.GetBitmap(Image1.Picture.Bitmap);

if ConnectForm.TCPClient.Connected then
begin
try
ConnectForm.TCPClient.WriteBuffer(MyBlock,SizeOf(MyBlock),true);
ConnectForm.TCPClient.WriteStream(MyBlock.m_stream,true);
except
end;
end;

finally
Stream.Free;
end;

end;

服务端:
procedure TServerForm.TCPServerExecute(AThread: TIdPeerThread);
var
jpg: TJpegImage;
MyBlock:TMyBlock;
getstream:TStream;
begin
if AThread.Connection.Connected and not AThread.Terminated then
begin
getstream:=TStream.Create;
AThread.Connection.ReadBuffer(MyBlock,SizeOf(MyBlock));
AThread.Connection.ReadStream(getstream,-1,true);
listbox1.Items.Add(MyBlock.m_username);
getstream.Position:=0;
jpg := TJpegImage.Create;
jpg.LoadFromStream(getstream);
Image.Picture.Bitmap.Assign(jpg);
jpg.Free;
getstream.Free;
end;
end;
试试吧,我没法做调试,请谅
 
服务器端依然显示不了
 
接受答案了.
 
后退
顶部