关于Indy Tcpserver和Tcpclient 用了Indy以后我不担心多线程的问题。我的客户端和服务器端需要多次传送不同性质的数据,所以服务器端是否要使用循环代码读取客户端的内容?客户端通过发送不同的前缀让服务器知道并接收其后的数据。请高手解答。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 procedure TMainFrm.IdTCPServerExecute(AThread: TIdPeerThread);var MyRec : ClientWareRecord; SourceBmp : TBitmap; fbuf1:TMemoryStream; LibHandle: THandle; Jpg:Tjpegimage; protsTmp,strmypath,strMyip:string; ShowCalendar:Procedure(SourceBmp: TBitmap; Width, Height: Integer; JpgPath :string); Com, // System command Msg,sTmp : String;begin AThread.connection.ReadBuffer(MyRec,SizeOf(MyRec)); if MyRec.ClientComType = MP_GETTBMPTOTJPG then begin try SourceBmp := TBitmap.Create; SourceBmp.PixelFormat := pf24bit; SourceBmp.LoadFromFile(MyRec.ServerPath); jpg := TJPEGImage.Create; jpg.Assign(SourceBmp); //jpg.SaveToFile(JpgPath); //=================================================================== fbuf1:=TMemoryStream.Create; //=================================================================== jpg.SaveToStream(fbuf1); SourceBmp.FreeImage; FreeAndNil(SourceBmp); FreeAndNil(jpg); AThread.Connection.OpenWriteBuffer; AThread.Connection.Writestream(fbuf1,true,false); finally AThread.Connection.CloseWriteBuffer; end; end;end; 谁来优化下函数,webbrowser的POST发送 急!怎样给程序输入参数啊? 如何通过一个按钮定位到帮助中的书签?(详细内容见内) treeview的问题,请各位帮给以解决! 昆明delphi程序员一个月多少 TADOTable的动态创建 如何按 春-夏-秋-冬 排序? 谁能说一说Tmemo类是怎样编辑文字的,过程,方法等等,高分有送 Params.WndParent := GetDesktopWindow;导致的问题 怎么安.pas形式的组件 急,一个关于TrayIcon控件的问题^^^^^^怎么解决? [新手在线等]关于贴图后会图像被遮盖后消失的简单问题
var
MyRec : ClientWareRecord;
SourceBmp : TBitmap;
fbuf1:TMemoryStream;
LibHandle: THandle;
Jpg:Tjpegimage;
protsTmp,strmypath,strMyip:string;
ShowCalendar:Procedure(SourceBmp: TBitmap; Width, Height: Integer; JpgPath :string);
Com, // System command
Msg,sTmp : String;
begin
AThread.connection.ReadBuffer(MyRec,SizeOf(MyRec));
if MyRec.ClientComType = MP_GETTBMPTOTJPG then
begin try
SourceBmp := TBitmap.Create;
SourceBmp.PixelFormat := pf24bit;
SourceBmp.LoadFromFile(MyRec.ServerPath);
jpg := TJPEGImage.Create;
jpg.Assign(SourceBmp);
//jpg.SaveToFile(JpgPath);
//===================================================================
fbuf1:=TMemoryStream.Create;
//===================================================================
jpg.SaveToStream(fbuf1);
SourceBmp.FreeImage;
FreeAndNil(SourceBmp);
FreeAndNil(jpg);
AThread.Connection.OpenWriteBuffer;
AThread.Connection.Writestream(fbuf1,true,false);
finally
AThread.Connection.CloseWriteBuffer;
end;
end;
end;