Einzelnen Beitrag anzeigen

Kas Ob.

Registriert seit: 3. Sep 2023
353 Beiträge
 
#15

AW: Indy10 TCPServer Spam erkennen, hohe CPU Auslastung

  Alt 5. Okt 2024, 08:37
My knowledge and experience in Indy is quite shallow, i used different libraries and implement my own,

But i can say few things here:
1) The high CPU usage is .. well... wrong Execute loop, your loop is not existing, you should make sure after triggering "AContext.Connection.Disconnect;" that execute loop is not looping.
2) Just an assumption here, why are you using OnConnect instead of OnContextCreated ? this might solve your whole problem, as code calling Execute should check for formally valid and correct Context before executing Execute and this include connected status, this pure assumption form my part though.

3) About you idea of making the port look closed, in other words to refuse connection before connect and before creating Context:
To look closed and hide the open port, the server should refuse to ACK connect, the closest thing you can do with Windows OS without using Firewall is to use WSAAccept : https://learn.microsoft.com/en-us/wi...ock2-wsaaccept
I have this working and it is just perfect, the callback will be called before accepting any socket, giving you the ability to refuse connection and implement a neat filtering system, with Indy it might be tricky due the multi layer and my lack of knowledge, or it could be very easy by replacing ... well here what i can't say for sure, it might be only TIdServerIOHandler inherited one or by adding your own TIdServerIOHandlerSocket with .. or simply by adding your own TIdServerIOHandlerStack.
not so helpful i know

Hope that helps.
Kas
  Mit Zitat antworten Zitat