indy

how to block unknown clients in indy (Delphi)

自闭症网瘾萝莉.ら 提交于 2019-12-06 17:32:13
问题 I have a public server(configured with indy 10) . some unknown clients are sending thousands of no content messages that it change the server's cpu usage to 50% . i have no firewall on my server , so i tried to block the unknown clients with this codes : This is a function that works with a Timer : var i, j: integer; begin IX2 := IX2 + 1; SetLength(ClientIPs, IX2); ClientIPs[IX2 - 1] := StrIP; j := 0; for i := low(ClientIPs) to high(ClientIPs) do begin Application.ProcessMessages; if

Reading response from TIdDNSResolver?

邮差的信 提交于 2019-12-06 14:33:18
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: TIdDNSResolver DNS.QueryType:= [qtA]; DNS.Resolve(Name); for X:= 0 to DNS.QueryResult.Count-1 do

Protect a string buffer from two threads?

笑着哭i 提交于 2019-12-06 13:49:23
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 strings too? Or just objects? Can I feel safe with this reading/writing of the same string from two different

Delphi XE3 indy compatibility issue between tbytes and tidbytes

北战南征 提交于 2019-12-06 10:49:50
I already saw post at Delphi XE4 Indy compatibility issue between TBytes and TidBytes about compatibility issues between the data types tbytes and tidbytes. From the second answer I learned, that it looks like they can't be used together even though they're both array of byte. However, the latest answer says, that in indy 10.5.9 it was dependent of the presence of TBytes, and that only in Indy 10.6 was it completely submitted as array of byte. Anyway,I have a .pas unit which decodes several packets from IdUDPServerUDPRead event, but can't get them together. I always get the error: [dcc32 Error

How to Implement uPnP on Delphi XE2

老子叫甜甜 提交于 2019-12-06 10:43:03
问题 I have a Http server implemented using indy TidHTTPServer on Delphi XE2. This product is mostly used for intranet, however sometimes it is needed to be accessed from internet also. The target customers are small companies, and for this PnP capabilities is a must. For internal use this server uses the current IP from the server and try to assign the port 8888. I want to discover a wandevice on the network that can let me ask for port routing. I am not sure port routing is the best solution

Post a file through https using indy / delphi components

穿精又带淫゛_ 提交于 2019-12-06 09:47:23
问题 I'm trying to upload a file through https by using Indy components in delphi. Here is my code: HTTP := TIdHTTP.Create(Self) IOHandler := TIdSSLIOHandlerSocketOpenSSL.Create; HTTP.Request.Host := RemoteHost; HTTP.Request.Connection := 'keep-alive'; HTTP.Request.Accept := 'multipart/mixed'; HTTP.IOHandler := IOHandler; HTTP.ConnectTimeout := 0; HTTP.ReadTimeout := 0; //### CREATE FILE TO SEND TestStream := TIdMultipartFormDataStream.Create; try //### POST PARAMETERS TestStream.AddFormField(

How to use TIdThreadSafe class from Indy10

风格不统一 提交于 2019-12-06 08:20:46
问题 can I use the Indy Command TIdThreadSafe to make a class MyPrivateClass threadsafe if I define a new Class MyNewIndyClass = Class(TIdThreadSafe) FLocal : MyPrivateClass create ...... end; My MyPrivateClass is not Threadsafe as I access TList and TBitmap items inside this class If I change the TCPServer.Onexecutde Code to to following style ...... aNewIndyClass := MyNewIndyClass.Create; aNewIndyClass.FLocal.CallFuntionA; aNewIndyClass.FLocal.CallFuntionB; ...... Idea for this approach : Keep

VirtualTreeView add roots with Threads

◇◆丶佛笑我妖孽 提交于 2019-12-06 07:53:21
I would like to add roots to a VirtualTreeView http://www.delphi-gems.com/index.php/controls/virtual-treeview with a thread like this: function AddRoot ( p : TForm1 ) : Integer; stdcall; begin p.VirtualStringTree1.AddChild(NIL); end; var Dummy : DWORD; i : Integer; begin for i := 0 to 2000 do begin CloseHandle(CreateThread(NIL,0, @ADDROOT, Self,0, Dummy)); end; end; The reason for this is that I want to add all connections from my INDY Server to the TreeView. Indy's onexecute/onconnect get's called as a thread. So if 3+ connections come in at the same time the app crashes due to the TreeView.

How to do NTLM Authentication using Indy 10 in Delphi 7?

让人想犯罪 __ 提交于 2019-12-06 06:38:10
问题 I want to do NTLM Authentication with Indy 10 Components in Delphi 7 . Here is my source code : uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs ,StdCtrls, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdHTTP,IdAuthenticationSSPI , IdAuthentication , IdAuthenticationDigest , IdHeaderList; procedure TForm1.Button1Click(Sender: TObject); begin Memo1.Lines.add( IdHTTP1.Get('http://www.google.co.in')); end; procedure TForm1

Delphi: TIdHTTP vs TNetHTTPClient

℡╲_俬逩灬. 提交于 2019-12-06 05:42:13
I'm writing a download manager in Delphi with some custom features like resumable downloads and downloading through proxies. I'm studing different component solutions: Indy and NetHTTP, both seem very close. TNetHTTPClient seem to be an interface of winhttp.dll . TIdHTTP seem to be an interface of wininet.dll (but i'm not sure). TIdHTTP seems like a very old component (maybe very stable/tested) and has tons of documentation online. TNetHTTPClient seems to be a very recent component, and doesn't have good documentation online. I'm a bit undecided... which one to choose? The point is: what is