indy

Read and save part of file stream via IdHTTP

孤人 提交于 2019-12-07 13:24:16
问题 I want to download a file from a HTTP server via a file stream and only read (and save to a file) the first few lines, say 100. After reading the first 100 lines the file stream must end: so I do NOT want to download or read the entire file. Below you can find what I have so far. The website is just an example. Can someone guide me in the right direction? const myURL = https://graphical.weather.gov/xml/DWMLgen/schema/latest_DWML.txt var fs: TMemoryStream; http: TIdHTTP; begin fs :=

How to conditionally compile a newer Indy feature?

江枫思渺然 提交于 2019-12-07 12:12:41
问题 I've already found this answer on how to check the Indy version at run-time, and there are multiple different ways. However I'm looking how to use conditionals to check the Indy version at compile-time. There's a feature in newer versions of Indy, and I want my open-source project to use this feature if it's available. But I need to conditionally compile it. I've found IdVers.inc , but this file only contains constants - no version conditionals. More specifically, the TIdHTTP has a property

sending mail but no message-id

落爺英雄遲暮 提交于 2019-12-07 11:48:16
问题 I am getting interesting rejections from my clients mail server when sending a mail with indy-10's tidMessage component saying: 550 Rejected: Message does not contain a Message-ID I get this even when using indy's own demo app http://www.indyproject.org/DemoDownloads/Indy_10_MailClient.zip what do I do to fix this. thanks! 回答1: TIdMessage in Indy 10 intentionally omits the 'Message-Id' header when encoding an email to a socket or TStream. You will have to use the TIdMessage.ExtraHeaders

Delphi - Is TDictionary thread safe

烈酒焚心 提交于 2019-12-07 09:13:43
问题 My idea is to use TDictionary to manage client connections on IdTCPServer. Here is a simple example code (not tested) for understanding purposes: var Dic: TDictionary<string, TIdContext>; procedure TfrmMain.FormCreate(Sender: TObject); begin Dic := TDictionary<string, TIdContext>.Create; end; procedure TfrmMain.FormDestroy(Sender: TObject); begin Dic.Free; end; procedure TfrmMain.TCPServerConnect(AContext: TIdContext); var Hostname: string; begin Hostname := UpperCase(GStack.HostByAddress

Delphi (Indy) TIdTCPClient in thread

微笑、不失礼 提交于 2019-12-07 07:17:55
问题 All around the internet I see it appears to be commonly done to place a "TIdTCPClient" inside a custom TThread descendent... why is this done? Sometimes I see the server in such a thread too...why? Cheers, Adrian 回答1: Indy uses blocking I/O, which is best handled in threads, and this is core to Indy's overall design. Blocking the main UI thread gives users the impression that the app is frozen when it really isn't. Have a look at "Introduction to Indy" for more information. 来源: https:/

Porting PHP code to Delphi code [closed]

↘锁芯ラ 提交于 2019-12-07 04:26:25
Closed. This question is off-topic . It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I am working on integrating tor to my Delphi application; the whole story is explained in this link After that I searched the internet then I found a code to switch new identity in PHP function tor_new_identity($tor_ip='127.0.0.1', $control_port='9051', $auth_code=''){ $fp = fsockopen($tor_ip, $control_port, $errno, $errstr, 30); if (!$fp) return false; //can't connect to the control port fputs($fp,

Delphi - Indy - saving GMail draft

断了今生、忘了曾经 提交于 2019-12-07 04:01:09
问题 I've been using Indy under Delphi to send message via a gmail account, using the TIdSMTP and TIdMessage components. This works absolutely fine. However, my client has requested to save the message to the DRAFTS folder to allow him to make changes to the (programatically created) message before actually sending it. GMail API is supposed to support this, but the provided examples are not in Delphi/Indy formats... I'm looking for minimal programming changes so I'd like to know if it is possible

Sending and receiving data streams in Delphi

↘锁芯ラ 提交于 2019-12-07 02:18:30
I want to create a software to connect to another and send some data (text based) to another program through the internet. The software will send data every 300 milliseconds (using timer) and the receiver must receive the data on time. The connection can be like the following any data can be lost; but the rest must arrive on time with minimum delay as possible (maximum 2 seconds); the delayed data can be considers as lost, can be ignored. I think it may be similar to a video conference software, but only using simple text as data. Can anyone tell me how to make such a program, specifically

Can I check the Indy version installed?

夙愿已清 提交于 2019-12-07 02:08:53
问题 I need to use the latest Indy component library version. Can I get the library version by some source code command or any other trick to make sure I'm using the correct lib. I know I'm using the indy....160.bpl - this is what my Delphi XE2 says while moving the mouse over the component bar. The latest INDY lib I take from Fulgan Indy 回答1: How to get version of Indy by using an Indy component at runtime ? As @Remy pointed out in his comment, you can get the Indy version from any Indy component

how to lookup dns records with indy in delphi

我怕爱的太早我们不能终老 提交于 2019-12-07 02:01:30
How can I lookup DNS records with Indy in Delphi? For example, SRV records, SPF records, TEXT records, etc. I know we can use nslookup directly from Windows, but I want to do this with Indy, or any other Delphi component. I tried searching Google, and I found something like this: function ReverseDNSLookup(IPAddress: String; DNSServer: String = SDefaultDNS; Timeout: Integer = 30; Retries: Integer = 3) : string; var AIdDNSResolver: TIdDNSResolver; RetryCount: Integer; begin Result := ''; IPAddress := ReverseIP(IPAddress); AIdDNSResolver := TIdDNSResolver.Create(nil); try AIdDNSResolver