troubleshooting Question

Help me to disconnect connections without data

Avatar of lhquang
lhquangFlag for Viet Nam asked on
6 Comments1 Solution783 ViewsLast Modified:
help me, my question is very noob :(

//s is TIdTCPServer
procedure TForm1.sConnect(AThread: TIdPeerThread); // this is line 1
var data:string;
    if data="login@username1@password1" then
          if checkacc(...) then
                  exit; // line 10
    showmessage('here is line 13'); // this line called "line 13"
    athread.Connection.disconnect(); // this line called "line 14"

I want my server socket application will read data and check data when user connected, if username,password  correct, line 10 will exit the procedure , if not correct,line 13 will be executed and  line 14 will disconnect the current connection

:(( but when the user connected to my server appicaltion without writeln("login@user1@pass1") ,it just connected only, line 13 will never reached and the s.Threads.LockList.count will be increased by 1 until the user disconnected

someone can make a client app that can connect to my server frequently without disconnecting and in my app server , s.Threads.LockList.count will be bigger and bigger

experts, please help me, how can I detect that and disconnect a connection without data within event TIdTCPServer.OnConnect, i just want to keep the connections with data only

thank all.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 6 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros