TServerSocket OnDisconnect

Hello all,  I have made a list of all user (Ip addr) connected on the server in a listbox and when one of them disconnect I want to know which one (exacly) to delete it from the list. How do I do this?
Thanks
mabellAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

intheCommented:
Hi
ping the ip address and the one that not there delete from listbox..
get ping compoenent from http://www.rtfm.be/fpiette/indexuk.htm 

Regards Barry
0
EpsylonCommented:
OnConnect and OnDisconnect have a Socket parameter. In your OnConnect event store Socket.SocketHandle in the userlist. In the OnDisconnect event search the userlist for the matching Socket.SocketHandle and delete that user from the list.

0
mabellAuthor Commented:
It's a good way but what if the client stay on the Net after disconnecting to the server (the server is my app) ?? Does it have a code that I can put in the TServerSocket.OnDisconnect event to determine which socket have been disconnected ?? If yes ...
Thanks :-)
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

mabellAuthor Commented:
Ok thanks Epsylon .. post your comment as an answer and I will give you the points :-)
0
mabellAuthor Commented:
Sorry inthe but the client may stay on the Net after disconnecting from my server
so your solution doesn't work for me.
thanks
0
DrDelphiCommented:
Why don't you have a thread polling the connections and delete the client from the listbox if they drop from one pass to another?
0
EpsylonCommented:
Ok, here is the answer again:

OnConnect and OnDisconnect have a Socket parameter. In your OnConnect event store Socket.SocketHandle in the userlist. In the OnDisconnect event search the userlist for the matching Socket.SocketHandle and delete that user from the list.


Thanks for the points Mabell   :o)

Cheers,

Epsylon.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MoondancerCommented:
This question was awarded, but never cleared due to the JSP-500 errors of that time.  It was "stuck" against userID -1 versus the intended expert whom you awarded.  This corrects the problem and the expert will now receive these points; points verified.

Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them.  If you are an EE Pro user, you can also choose Power Search to find all your open questions.

This is the Community Support link, if help is needed, along with the link to All Topics which reflects many TAs recently added.

http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
http://www.experts-exchange.com/jsp/zonesAll.jsp

For experts interesting in helping the cleanup effort in their respective TAs, this link please:
http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=commspt&qid=20274643
 
Thank you,
Moondancer
Moderator @ Experts Exchange
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.