indy

Download file progressively using TIdHttp

依然范特西╮ 提交于 2019-12-02 16:21:16
I want to implement a simple http downloader using TIdHttp (Indy10). I found two kind of code examples from the internet. Unfortunately none of them satisfy me 100%. Here is the code and I want some advise. Variant 1 var Buffer: TFileStream; HttpClient: TIdHttp; begin Buffer := TFileStream.Create('somefile.exe', fmCreate or fmShareDenyWrite); try HttpClient := TIdHttp.Create(nil); try HttpClient.Get('http://somewhere.com/somefile.exe', Buffer); // wait until it is done finally HttpClient.Free; end; finally Buffer.Free; end; end; The code is compact and very easy to understand. The problem is

Delphi 7 Occasional deadlock changing TLabel.Font.Style from IdHTTPListener event

北慕城南 提交于 2019-12-02 16:08:09
问题 Wondered if anyone could help with a really tricky sporadic (not consistently reproducible) issue - possibly to do with threads. I'm in Delphi 7 (it's old code...), running an IdHttpListener (Indy). Code below is copied from a large cumbersome app - but hopefully enough to explain. An incoming HTTP request runs the following event - where web_lock is a TCriticalSection I define at the top. I do it in a critical section as the web requests causes changes that I need to be atomic. procedure

Getting HTML from response stream using Indy's IDTCPClient [closed]

北城余情 提交于 2019-12-02 13:43:55
I have a component that a previous employee has created. It uses Indy (IDTCPClient) and the following method to perform requests (Where "aReadHeader" is a predefined Uri built before being passed in). function TMyConnector.GET(aRawHeader: String): String; begin if Not Connected then Connected := True; if Connected then begin FRawRequest := 'GET /'+ aRawHeader + ' HTTP/'+HTTPVerText+#13#10+ 'Host: '+FHost+#13#10+ 'Cookie: UserHPos=IOGLO00003000090000C000BS; '+ 'LOSID=qsBiy/wEDCq6tOXFzGbOlTD1lmo5AXdFnCkbzzPn6+qCeheYVyTcumRrjsqh+Hds4Fr2gZDazfDzGN1RA+nnHuQQeBy78ZUgctrZyyy9MnGl2qI/ulkV6EPxAfmmLg

How to send several emails in a single connection of IdSMTP?

感情迁移 提交于 2019-12-02 10:26:34
I am using Indy 10 on C++Builder 6.0 Professional Edition. My SMTP server imposes a limit on the number of connections in a certain time interval, so I need to send more than one email using the same connection. Is it possible? How can I do that ? I am already able to connect and send one email on each connection. Thank you very much for any help. You can call TIdSMTP.Send() multiple times between a single pair of Connect() / Disconnect() calls, adjusting the TIdMessage as needed for each Send() call. IdSMTP1.Connect; try // prepare TIdMessage as needed... IdSMTP1.Send(IdMessage1); // prepare

Delphi 7 Occasional deadlock changing TLabel.Font.Style from IdHTTPListener event

牧云@^-^@ 提交于 2019-12-02 10:05:23
Wondered if anyone could help with a really tricky sporadic (not consistently reproducible) issue - possibly to do with threads. I'm in Delphi 7 (it's old code...), running an IdHttpListener (Indy). Code below is copied from a large cumbersome app - but hopefully enough to explain. An incoming HTTP request runs the following event - where web_lock is a TCriticalSection I define at the top. I do it in a critical section as the web requests causes changes that I need to be atomic. procedure TFWebServer.WebServerCommandGet(Thread: TIdPeerThread; RequestInfo: TIdHTTPRequestInfo; ResponseInfo:

Implementing SNMP SendTrap using Indy components

你说的曾经没有我的故事 提交于 2019-12-02 09:31:31
I need to report errors from my application on C++Builder via SNMP. I started implementing SNMP SendTrap using Indy components. void __fastcall TMainForm::btSendTrapClick(TObject *Sender) { UnicodeString myEnterprise = "1.5.5.5.5.5.5.5"; UnicodeString eventType = "1.5.5.5.5.5.5.5.1"; UnicodeString eventDistance = "1.5.5.5.5.5.5.5.2"; TIdSNMP * idSnmp = 0; TSNMPInfo * infoSnmp = 0; idSnmp = new TIdSNMP(NULL); infoSnmp = new TSNMPInfo(idSnmp); idSnmp->Host = edHost->Text; idSnmp->Community = "public"; infoSnmp->Host = edHost->Text; infoSnmp->Community = "public"; infoSnmp->Enterprise =

¿How can I send and recieve strings from tidtcpclient and tidtcpserver and to create a chat?

孤街浪徒 提交于 2019-12-02 08:34:31
im new at delphi languaje and im using Rad Studio to make apps work on every device with oune single programming. Right now Im supposed to make a chat using sockets, I made a chat for windows only using tclientsocket and tserversocket using the next code, what Im trying to do is make the exact thing but using tidtcpclient and tidtcpserver instead of tclientsocket and tserversocket Server: unit Server; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, System.Win.ScktComp, Vcl.StdCtrls; type

Create video streaming server in indy

房东的猫 提交于 2019-12-02 06:13:29
I am trying to create video streaming server using Indy Http server. I am using ranged requests to send large files. One chunk of data is 10 Mb long. If video file which requests client is smaller than 10 Mb then it is all ok and vido is played. But if file size is longer than 10 Mb I return first chunk of data. Then client asks me for another chunk of data from the end of file and then my client says that it is unrecognizable video format. Can someone tell me where is problem in my code. my server code procedure TForm1.Button1Click(Sender: TObject); begin Caption := 'Running'; FServer :=

Delphi Error E2010 Incompatible types: 'string' and 'procedure, untyped pointer or untyped parameter'

倖福魔咒の 提交于 2019-12-02 03:47:28
I used TStringList and something that looks like: geo: TStringList; response: TStringStream; begin http:=tidhttp.Create(nil); try { TODO -oUser -cConsole Main : Insert code here } geo:=TStringList.Create; response:=TStringStream.Create(''); geo.Add('name=stas'); geo.Add('pass=431'); s:=http.Get('http://test.me'); writeln(http.ResponseText); writeln(s); s:=http.Post('http://test.me',geo,response); but something is wrong. For example when I run it it's alerting with the error [[DCC Error] consoleHttp.dpr(29): E2010 Incompatible types: 'string' and 'procedure, untyped pointer or untyped parameter

Garbage in headers when POST-ing with Indy 10.5.8

纵然是瞬间 提交于 2019-12-02 00:17:06
I'm trying to send a file using POST in multipart/form data via Indy 10.5.8. I'm using Delphi XE2 and I've been trying to POST a file to a server. This is the firs time I've tried this and since my experience with Indy is quite limited, i took the following snippet of code: unit MsMultiPartFormData; interface uses SysUtils, Classes; const CONTENT_TYPE = 'multipart/form-data; boundary='; CRLF = #13#10; CONTENT_DISPOSITION = 'Content-Disposition: form-data; name="%s"'; FILE_NAME_PLACE_HOLDER = '; filename="%s"'; CONTENT_TYPE_PLACE_HOLDER = 'Content-Type: %s' + crlf + crlf; CONTENT_LENGTH =