delphi - 谁能举个使用套接字发送文件的例子吗?

标签 delphi sockets delphi-7 winsock

我需要创建两个程序:

  • 服务器
  • 客户端

  • 服务器向客户端发送请求,然后客户端使用此功能接收请求并捕获屏幕:
    function GetScreenShot(PixelFormat:TPixelFormat;Width,Height:Integer): TBitmap;
    var
      Desktop: HDC;
    begin
      Result  := TBitmap.Create;
      Desktop := GetDC(GetDesktopWindow);
      try
        try
          Result.PixelFormat := PixelFormat;
          Result.Width := Width;
          Result.Height := Height;
          BitBlt(Result.Canvas.Handle, 0, 0, Result.Width, Result.Height, Desktop, 0, 0, SRCCOPY);
          Result.Modified := True;
        finally
          ReleaseDC(0, Desktop);
        end;
      except
        Result.Free;
        Result := nil;
      end;
    end;
    

    之后,客户端将位图发送到服务器。

    有人能帮我吗?

    编辑添加:

    我有一些例子:
  • This works
  • This works too
  • C++ and Delphi
  • 最佳答案

    关于delphi - 谁能举个使用套接字发送文件的例子吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5847084/

    相关文章:

    python - _socket 文件在哪里?

    c - 如何在 C 中打开和使用套接字?

    windows - 如何取消延迟的 MoveFileEx 操作?

    delphi - 将两个字节合并为 WideChar

    Delphi通用约束问题

    delphi - 是否有一个 DivMod *不*限于单词 (<=65535)?

    linux - 传递 *from* 时,recvfrom 返回无效参数

    delphi - 如何根据 Delphi 7 中的值对 TStringList 进行排序

    delphi - 如何获取内部System.pas函数的地址?

    与 Delphi 10.4.2 一起使用的 Android 模拟器