delphi 纯Window系统API实现的SSL客户端  
官方Delphi 学习QQ群: 682628230(三千人)
频道

delphi 纯Window系统API实现的SSL客户端


program Project1;

{$APPTYPE CONSOLE}

uses
  Winapi.Windows,
  Unit_SSL in 'Unit_SSL.pas';

Const
  pSend :PAnsiChar = 'GET / HTTP/1.1' + #13#10 +
  'Host: github.com' + #13#10 +
  'User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko' + #13#10 +
  'Accept:*/*' + #13#10#13#10;
Var
  lpSSL  :TSSL_Socket;
  Buffer :PAnsiChar;
begin
  lpSSL := TSSL_Socket.Create;
  lpSSL.UseSSL := True;
  lpSSL.Connect('github.com', 443);
  if lpSSL.Connected then
  begin
    If lpSSL.Send(pSend, lstrlenA(pSend)) > 0 Then
    begin
      Buffer := GetMemory(1024 * 1024 * 64);
      lpSSL.Recv(Buffer, 1024 * 1024 * 64);
      Writeln(Buffer);
      FreeMemory(Buffer);
    end;
    lpSSL.Disconnect;
  end;
  lpSSL.Free;
  Readln;
end.

来源:https://www.7xcode.com/archives/115.html

推荐分享
图文皆来源于网络,内容仅做公益性分享,版权归原作者所有,如有侵权请告知删除!
 

Copyright © 2014 DelphiW.com 开发 源码 文档 技巧 All Rights Reserved
晋ICP备14006235号-8 晋公网安备 14108102000087号

执行时间: 0.047438859939575 seconds