indy

Reading response from TIdDNSResolver?

倖福魔咒の 提交于 2019-12-22 17:09:02
问题 I cannot find any simple examples of a DNS lookup using Indy 10's TIdDNSResolver component. They're all either for something I don't need (such as MX/SMTP), or are talking terms with no code . I have tried reading the result based on the few resources I can find, but don't know how I'm supposed to be reading the result. Here's what I have so far... uses IdBaseComponent, IdComponent, IdTCPConnection, IdDNSResolver; function TForm1.Lookup(const Name: String): String; var X: Integer; begin //DNS

Reading response from TIdDNSResolver?

若如初见. 提交于 2019-12-22 17:08:34
问题 I cannot find any simple examples of a DNS lookup using Indy 10's TIdDNSResolver component. They're all either for something I don't need (such as MX/SMTP), or are talking terms with no code . I have tried reading the result based on the few resources I can find, but don't know how I'm supposed to be reading the result. Here's what I have so far... uses IdBaseComponent, IdComponent, IdTCPConnection, IdDNSResolver; function TForm1.Lookup(const Name: String): String; var X: Integer; begin //DNS

How can I use TIdUDPServer in a console application?

若如初见. 提交于 2019-12-22 11:26:52
问题 The Indy UDP server component seems to depend on Windows messages, as I see new messages appear only when the mouse cursor moves over the form which contains the server component. I created the component at run time using this code: private { Private declarations } Srv: TIdUDPServer; ... procedure TForm1.FormCreate(Sender: TObject); begin Srv := TIdUDPServer.Create(Self); Srv.DefaultPort := 9009; Srv.OnUDPRead := Self.udpServerUDPRead; Srv.Active := True; end; I would prefer a console or

Using the Indy TidHttp component to send email file attachments through sendgrid

。_饼干妹妹 提交于 2019-12-22 11:03:35
问题 I am using the Indy TIdHTTP component and am successfully able to send emails via the sendgrid API using the following function. The sendgrid api documentation can be found here. Now I am tasked with including file attachments. In the API documentation it states: The file contents must be part of the multipart HTTP POST I have attempted to modify my function to include the TIdMultipartFormDataStream with no success. How should I modify the code to support file attachments? procedure

Send e-mail using gmail and Indy

試著忘記壹切 提交于 2019-12-22 05:54:11
问题 I am trying to send an e-mail from Delphi using gmail. I have Indy 10.5.9.0 and Delphi XE3. I got example code from: http://www.andrecelestino.com/delphi-xe-envio-de-e-mail-com-componentes-indy/ I also tried other example codes but with same results. I have libeay32.dll and ssleay32.dll from here: http://www.andrecelestino.com/wp-content/files/DLLs-SSL-DelphiXE.rar but I also tried: http://indy.fulgan.com/SSL/openssl-1.0.2d-i386-win32.zip with no luck. My code (FULL): uses Windows, Messages,

Indy TIdTCPClient receive text

 ̄綄美尐妖づ 提交于 2019-12-22 00:27:47
问题 I try to receive text in a idtcpclient but it does not work. This is the code that I use in a timer: procedure TForm1.Timer2Timer(Sender: TObject); var receivedtext:string; begin if idtcpclient1.Connected = true then begin with idtcpclient1 do begin if not IOHandler.InputBufferIsEmpty then begin try receivedtext := IOHandler.ReadLn; finally if receivedtext = '' = false then begin showmessage(receivedtext); idtcpclient1.IOHandler.InputBuffer.Clear; receivedtext := ''; end; end; end; end; end

Detecting the Mime-Type of a file on a remote server with INDY

大城市里の小女人 提交于 2019-12-21 17:48:08
问题 I have been using the Synapse library to download files from the internet, but I have recently converted my application to use INDY instead and I am missing one of the nicer features in the Synapse library which is the ability to easily get the Mime-Type of a file that I was downloading from a server before saving it to my local machine. Does INDY have this feature and if so how do I go about accessing it? 回答1: You can issue an HTTP HEAD request and check the Content-Type header. Before you

TIdHttp.Post - can't get utf-8 encoding

混江龙づ霸主 提交于 2019-12-21 17:46:08
问题 How can I force TIdHttp.post method to return the web page encoded in utf-8? I tried http.Request.ContentEncoding := 'UTF-8' but it doesn'twork. Here's my code: procedure TeUpdateNews.Check; var url: string; Http: TIdHttp; SS: TStringStream; param: TStringList; SWIDESTRING: WideString; begin http := TIDHttp.Create(nil); http.HandleRedirects := true; http.ReadTimeout := 5000; http.Request.ContentEncoding := 'UTF-8'; param := TStringList.create; param.Clear; url := CONST_SOME_WWW; try SS :=

Indy 10 - IdSMTP.Send() hangs when sending messages from GMail account

别说谁变了你拦得住时间么 提交于 2019-12-21 16:18:46
问题 I am trying to send an e-mail using gmail account (Delphi 7, Indy 10) with these settings: TIdSmtp: Port = 587; UseTLS := utUseExplicitTLS; TIdSSLIOHandlerSocketOpenSSL: SSLOptions.Method := sslvTLSv1; Everything seems to be set ok. I get this response: Resolving hostname smtp.gmail.com. Connecting to 74.125.77.109. SSL status: "before/connect initialization" SSL status: "before/connect initialization" SSL status: "SSLv3 write client hello A" SSL status: "SSLv3 read server hello A" SSL status

Reading data with TIdUDPServer

淺唱寂寞╮ 提交于 2019-12-21 06:39:14
问题 I would like to read data from an electronic device that sends data to my PC by UDP. I have programmed a UDP server in Delphi. An exception occurs in class EIdSocketError (Failure #10049). Here is my code: procedure TForm1.Button1Click(Sender: TObject); begin IdUDPServer1.Bindings.add.IP := '192.168.1.1'; //Electronic device ip IdUDPServer1.Bindings.add.Port:= 49152; //Electronic device port IdUDPServer1.OnUDPRead:= UDPRead; IdUDPServer1.Active:=True; end; procedure TForm1.UDPRead (Sender: