标签: indy

我怎样才能PING线程,读取Delphi 6中的OnReply事件?

TIdIcmpClient我对 Delphi 6 和 Indy 的组件有疑问。

在编译以下代码时,我在标记行 (51) 中收到此消息:

FPing.OnReply := OnPingReply;

[错误] fire.pas(51):不兼容的类型:“TComponent”和“TIdIcmpClient”

我应该如何修复它?

unit fire;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, IdBaseComponent, IdComponent, IdRawBase, IdRawClient,
  IdIcmpClient;

type
  TForm1 = class(TForm)
    ListBox1: TListBox;
    Button1: TButton;
    Memo1: TMemo;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

type
  TMyThread = class(TThread)
  private
    FIndex: Integer;
    FPing:  TIdIcmpClient;
    FIP: string;
  protected
    procedure Execute; override; …
Run Code Online (Sandbox Code Playgroud)

delphi indy delphi-6

0
推荐指数
1
解决办法
116
查看次数

Indy HTTP Server ARequestInfo.Params.Text 编码错误

我正在使用 Delphi 10.4.2 、 Indy 10.6.2.0 。

\n

我已经尝试过这个解决方案:Indy HTTP Server URL-encoded request,但我想我误解了一些东西。

\n

我从 Web 应用程序获取 JSON,如下所示:

\n
procedure TForm1.IdHTTPServer1CommandGet(AContext: TIdContext;\n  ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);\nbegin\n  If ARequestInfo.CommandType = hcPOST then\n  begin\n\n    MyDecodeAndSetParams(ARequestInfo);\n\n    Memo1.Lines.Add(ARequestInfo.Params.Text);\nend;\n
Run Code Online (Sandbox Code Playgroud)\n

我可能做错了什么,但我的结果仍然不正确:

\n

D 卡尔斯鲁厄 / S\xc3\x83\xc2\xbcdweststadt, 班霍夫大街\xc3\x83\xc5\xb8e

\n

应该是\nS\xc3\xbcdweststadt 和 Bahnhofstra\xc3\x9fe

\n

请帮忙。\n谢谢。

\n

delphi indy

0
推荐指数
1
解决办法
52
查看次数

使用TIdFTP进行Delphi连接测试

在我的程序中,我实际上使用此代码:

if IdFTP1.Connect = True then
 begin
  //makes some stuff
 end
else
 begin
  ShowMessage('you got the move like jagger.');
 end;
Run Code Online (Sandbox Code Playgroud)

如果我没有连接,我会看到一个错误

套接字错误#11001

主机未找到

为了避免这种情况,我认为我可以使用您在上面看到的代码,但我在使用时遇到错误IdFTP1.Connect = True.

我能做什么?

delphi indy indy10 delphi-xe4

-1
推荐指数
1
解决办法
2636
查看次数

delphi中的链式代理

我刚刚阅读了关于链接代理的内容,我想在delphi中尝试它,好吧我用indy TIdHttp组件玩,我无法弄清楚如何做到这一点,我需要两个TIdHttp组件吗?也许一个人将请求发送给另一个人?

  http1.ProxyParams.ProxyPort := Port1;
  http1.ProxyParams.ProxyServer := Server1;

  http2.ProxyParams.ProxyPort := Port2;
  http2.ProxyParams.ProxyServer := Server2;
Run Code Online (Sandbox Code Playgroud)

我只想用链式代理发送一些简单的GET/POST.

这甚至可行吗?或者还有其他任何组件来帮助我完成这项任务吗?

谢谢.

delphi proxy indy chained

-1
推荐指数
1
解决办法
751
查看次数

期待JSON文本时的二进制HTTP响应内容

我正在使用delphi XE3上传一些图像到服务器,我用chrome拦截了请求,我基本上用IDhttp发送完全相同的请求,服务器响应200 OK,所以我猜一切都很顺利.问题是,我需要获取响应内容以获取上传图像的链接,但我得到的只是:

    ‹      •ÒK
à  лÌ:Ôù¨Õ\¥)P‚‹¤…,Cî^K–ÅÂlddà1¿ê:/e‡ñq@®kÙöúÚRÍ0Wº}&³–\çÉ×^   6   ä“‹ÄŽ's÷!²½½·Îᇣ¨â„1Ù€=I¥±Å$®¯±®¶ˆ‰±¯©íW¦Ûà?ËêFÖbñ=Ë©,j·Á¡gyÅßá_Öóü gÊr Á  
Run Code Online (Sandbox Code Playgroud)

这是什么 ?我怎样才能获得Json响应?

在Chrome上拦截的响应标头是:

Cache-Control:no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection:Keep-Alive
Content-Encoding:gzip
Content-Length:169
Content-Type:application/json
Date:Thu, 21 Nov 2013 12:29:40 GMT
Expires:Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive:timeout=5, max=100
p3p:CP="CAO PSA OUR"
Pragma:no-cache

    Server:Apache/2.2.22 (Debian)
    Vary:User-Agent,Accept-Encoding
    X-Powered-By:PHP/5.4.4-14+deb7u3t-Type:application/json
Run Code Online (Sandbox Code Playgroud)

delphi encoding gzip http indy

-1
推荐指数
1
解决办法
703
查看次数

从FTP服务器下载目录

我正在开发RAD Studio(IdFTP)的FTP客户端.我如何从服务器下载目录?Delphi或C++.谢谢.

delphi ftp indy c++builder-xe5

-1
推荐指数
1
解决办法
9689
查看次数

Delphi - Indy流验证

我正试图从客户端拍摄实时屏幕截图.

服务器端的TImage imgScreen引发了此错误.

EJPEG,消息'JPEG错误#53'

我有谷歌它,发现这个错误来自内存不足 - 图像损坏.

如何在保存/显示之前验证流?

使服务器收到损坏的流的原因是什么?

是在JpegStream.SizeIOHandler.ReadInt64方法中.

这是代码.

客户端

 if List[0] = 'RecordScreen' then
  begin
    pic := TBitmap.Create;
    JpegStream := TMemoryStream.Create;
    ScreenShot(0,0,pic);

    BMPtoJPGStream(pic, JpegStream);
    pic.FreeImage;
    FreeAndNil(pic);

    AConn.Client.IOHandler.Write(JpegStream.Size);
    AConn.Client.IOHandler.Write(JpegStream);
    FreeAndNil(JpegStream);
  end;
Run Code Online (Sandbox Code Playgroud)

服务器端

procedure ScreenRecord(const Item: TListItem);
var
  Ctx: TIdContext;
  List: TIdContextList;
  Dir,PicName:string;
  PicStream : TFileStream;
  Size : Int64;
begin
  if (Item = nil) then Exit;
  Ctx := TIdContext(Item.Data);
  if (Ctx = nil) then Exit;
  Dir := IncludeTrailingBackslash(TMyContext(Ctx).ClinetDir+ScreenshotsDir);
  if not DirectoryExists(Dir) then
  CreateDir(Dir);

  PicName …
Run Code Online (Sandbox Code Playgroud)

delphi indy

-1
推荐指数
1
解决办法
386
查看次数

Delphi&Indy httpServer如何停止发送400个错误请求

我从期望他回来ACK(HTTP1/1 200 OK)的设备获取数据.收到标题后我的httpserver会自动返回400 Bad Request(我在WareShark上看到).也许该设备没有正确构建他的请求.如何停止服务器不会返回错误?所以我将能够继续与设备通信.

谢谢


LOG: 192.168.1.141:57565 Stat Connected.

HTTP Connect 192.168.1.141
LOG: 192.168.1.141:57565 Recv 10.4.2017 ?. 00:18:43: POST / HTTP/1.1<EOL>

LOG: 192.168.1.141:57565 Recv 10.4.2017 ?. 00:18:43: Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/msword, application/x-shockwave-flash, text/*, */*<EOL>Accept-Language: en-us<EOL>Content-Type: application/x-www-form-urlencoded<EOL>Accept-Encoding: gzip, deflate<EOL>User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)<EOL>Content-Length: 579<EOL>Connection: Keep-Alive<EOL><EOL><?xml version="1.0"?><EOL><Metrics  SiteId="BG-001" Sitename="office Pazardjik"><EOL><Properties><EOL><MacAddress>00:b0:9d:7f:b7:b2</MacAddress><EOL><IpAddress>0.0.0.0</IpAddress><EOL><Timezone>2</Timezone><EOL><DST>1</DST><EOL><DeviceType>0</DeviceType><EOL><SerialNumber>8370098</SerialNumber><EOL></Properties><EOL><ReportData  Interval="1"><EOL><Report  Date="2017-04-06"><EOL><Object  Id="0" DeviceId="BG-001-01" Devicename="Main Entrance" ObjectType="0" Name="Main Entrance"><EOL><Count  StartTime="05:31:00" EndTime="05:32:00" Enters="0" Exits="0" Status="0"/><EOL></Object><EOL></Report><EOL></ReportData><EOL></Metrics><EOL>

HTTP Header 
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, …
Run Code Online (Sandbox Code Playgroud)

delphi indy httpserver

-1
推荐指数
1
解决办法
771
查看次数

没有重载版本的写入

我正在与xe6中的代码共享一个项目,我正在使用xe2版本16.我收到此错误

There is no overloaded version of 'write' that can be called with these arguments

在这个代码.

  {$IF CompilerVersion >= 19}
  // Modified code for Delphi XE5 & later
  tcpConnection.IOHandler.Write(TheMsg, IndyTextEncoding.Default  );
  {$ELSE}
  // Original XE2 code
  tcpConnection.IOHandler.Write(TheMsg, TIdTextEncoding.Default);
  {$IFEND}
Run Code Online (Sandbox Code Playgroud)

我还添加idGlobal了用途.这会导致错误的任何其他原因?

delphi indy delphi-xe2 delphi-xe6

-2
推荐指数
1
解决办法
505
查看次数

使用Indy的IDTCPClient从响应流中获取XML

这个问题与以下方面有直接关系:

使用Indy的IDTCPClient从响应流中获取HTML

我只需要一个版本的get函数来检索XML

function TMyConnector.GETXML(aRawHeader: String): String;
Run Code Online (Sandbox Code Playgroud)

使用idHTTP组件,我可以执行以下操作

HTTP.Request.ContentType := 'text/xml';
Run Code Online (Sandbox Code Playgroud)

我所追求的文件的标题如下所示:

<?xml version="1.0" encoding="utf-8" ?>
Run Code Online (Sandbox Code Playgroud)

如何使用IDTCPClient组件执行此操作?

xml delphi indy delphi-xe5

-4
推荐指数
1
解决办法
919
查看次数