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.
Senior Developer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Log in to continue reading
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform for $9.99/mo
View membership options
Unlock 1 Answer and 6 Comments.
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
The Value of Experts Exchange in My Daily IT Life

Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>


Owner of Outages.IO
Phoenix, Arizona, United States
Member Since 2016
Join a full scale community that combines the best parts of other tools into one platform.
Unlock 1 Answer and 6 Comments.
View membership options
“All of life is about relationships, and EE has made a virtual community a real community. It lifts everyone's boat.”
William Peck

Member since 2004