I have three questions:
is it possible to destroy IdTCPServer by to many connection? I tried to test my application and when I have several connections - it works very good (even several days) but when sometimes number of connection increases application gives acess violation. I wrote application similates 50 clients sending data constantly (with only sleep(200)). And in this situation IdTCPServer gives exceptions? My application reseives information from clients by onExecute event and modyfies databases table using TidNotify and TIdSync classes. I believe it protects crosses connections threads? Sending information to clients is doing by TTimer (it is only now, I'll change it to other thread). Have I use in this situation special protection or something like that is enough:
type PClient = ^TClient; TClient = record Activity_time:TDateTime; AContext: TIdContext; end; ... list := server.Contexts.LockList; try for i := 0 to list.Count - 1 do with TIdContext(list[i]) do begin if SecondsBetween(now(), PClient(data)^.activity_time) > 6 then begin Connection.IOHandler.Close; Continue; end; try Connection.IOHandler.writeln('E:'); Except Connection.IOHandler.Close; end; end; finally server.Contexts.UnlockList; end;
2.Is a simple way to refuse connection when server is to busy (I think my database isn't complicated (100 rows, only one row is modyfied by one connection) but maybe here is a way to keep stability of server?
3.I know that this question was repeating many times but I didn't find satisfying answer: how to protect application to avoid message exception: "Connection closed gracefully" and "Connection reset by peer"?
Thank You for all advices