indy

Protect a string buffer from two threads?

做~自己de王妃 提交于 2019-12-10 10:46:33
问题 I am working with streaming packet strings through Indy sockets, and on the client side, I have a thread which reads incoming data from the TIdTCPClient and continuously appending this data to the end of a single string buffer. I have another thread which is continuously reading this buffer from the beginning, copying (and deleting) data as necessary (one complete packet at a time). I know that in any case two threads accessing the same variable can be dangerous. But does this apply to

TidHashSHA512.isavailable is false on Windows 10

风格不统一 提交于 2019-12-10 10:42:40
问题 I am using that function on Delphi XE2 to hash a string. I have a bad result if the program is run on Windows 10 — the result is null because TidHashSHA512.isavailable is FALSE . What do I have to do? function HashSHA512String(Text: String): String; var IdHashSHA512: TIdHashSHA512; begin Result := ''; if HashFunctionsOpenSSLLoaded then begin if TIdHashSHA512.IsAvailable then begin // <-- ADD THIS IdHashSHA512 := TIdHashSHA512.Create; try Result := IdHashSHA512.HashStringAsHex(Text); finally

Indy Write Buffering / Efficient TCP communication

拈花ヽ惹草 提交于 2019-12-09 16:16:13
问题 I know, I'm asking a lot of questions...but as a new delphi developer I keep falling over all these questions :) This one deals with TCP communication using indy 10. To make communication efficient, I code a client operation request as a single byte (in most scenarios followed by other data bytes of course, but in this case only one single byte). Problem is that var Bytes : TBytes; ... SetLength (Bytes, 1); Bytes [0] := OpCode; FConnection.IOHandler.Write (Bytes, 1); ErrorCode := Connection

“1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number call:” on Indy

空扰寡人 提交于 2019-12-09 12:01:19
问题 I have a web app that makes frequent TIdHTTP calls to the Google Analytics API (around 25,000-50,000 per day). Every so often calls to the API fail with the error message in the subject line (not often - less than 1 out of 1000 times). I have never been able to find a pattern to get it to happen. And retrying the failed call usually works. So it seems entirely random. I have the latest version of openssl (1.0.2.1 - 03/20/2015). And the latest version of Indy (source code files dated 01/07

Indy 10 - IdSMTP.Connect raising “Could not load SSL library.”

别说谁变了你拦得住时间么 提交于 2019-12-09 08:58:33
问题 Here is my configuration: IdSMTP1.Host := 'smtp.gmail.com'; IdSMTP1.Port := 587; IdSMTP1.UseTLS := utUseExplicitTLS; IdSMTP1.IOHandler := IdSSLIOHandlerSocketOpenSSL1; IdSSLIOHandlerSocketOpenSSL1.SSLOptions.Method := sslvTLSv1; I've downloaded the OpenSSL from here, both libeay32.dll and ssleay32.dll are in the same folder of my application. The Indy version is: 10.0.52 The following command is working on my machine: telnet smtp.gmail.com 587 How to properly connect in a TLS enable SMTP

How to download a file with progress with IdHTTP via https

青春壹個敷衍的年華 提交于 2019-12-09 06:54:53
问题 I'm trying to download a file using indy10 http components TIdHttp while getting the progress , I have just setted the libraries in the application folder while using the code for http URL it works and progress but with https it simply does nothing and it doesn't raises any exception :/ with TIdHTTP.Create(nil) do begin IOHndl:=TIdSSLIOHandlerSocketOpenSSL.Create(nil); Request.BasicAuthentication:=True; HandleRedirects:=True; IOHandler:=IOHndl; OnWork:=FOnWork; OnWorkBegin:=FOnWorkBegin;

Indy TCP - Read data in a loop

南楼画角 提交于 2019-12-09 05:01:44
问题 A TCP server is sending data frames continuosly every 8ms. I want to program a client able to receive these data frames. Is there any procedure in Indy 9 to know if there is data available in the buffer? My current programs is the following (I am using a Thread): procedure TThreadRead.Execute; var buffer: array [0..755] of byte; //s1: string; //i: integer; begin IdTCPClient1.RecvBufferSize:= 756; IdTCPClient1.Connect; while Terminated = false do begin if IdTCPClient1.InputBuffer.Size = 0 then

What is the proper way to update Delphi 2009's default installation of Indy 10?

橙三吉。 提交于 2019-12-08 21:59:12
问题 Since Indy is now built-into the install process of Delphi 2009... is there a proper way to 'remove' it so it can be upgraded to the latest from the SVN repo? There isn't an automated option to remove it as far as I'm aware. 回答1: The dcu files for Indy are stored separately from the other Delphi units. To stop using them, simply remove that directory from the search path, library path, etc., and remove the source files from the browse path. You can remove the design-time packages the same as

Getting Response from TIdHttp with Error Code 400

筅森魡賤 提交于 2019-12-08 16:25:09
问题 I have been writing a Delphi library for StackApps API. I have run into a problem with Indy. I am using the version that ships with Delphi 2010. If you pass invalid parameters to one of the StackApps API it will return a HTTP Error Code 400 and then in the response it will contain a JSON object with more details. By visiting http://api.stackoverflow.com/0.8/stats/?Key=BadOnPurpose in Chrome Browser you can see an Example. I.E. and Firefox hide the JSON. Using WireShark I can see that the JSON

How to download faster?

会有一股神秘感。 提交于 2019-12-08 10:02:48
问题 What is the fastest way to download webpage source into a memo component? I use Indy and HttpCli components. The problem is that I have a listbox filled with more than 100 sites, my program downloads source to a memo and parses that source for mp3 files. It is something like a Google music search program; it uses Google queries to make Google search easier. I started reading about threads which lead to my question: Can I create a IdHttp instance in a thread with parsing function and tell it