Link to home
Start Free TrialLog in
Avatar of mabell
mabell

asked on

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
Avatar of inthe
inthe

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

Avatar of mabell

ASKER

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 :-)
Avatar of mabell

ASKER

Ok thanks Epsylon .. post your comment as an answer and I will give you the points :-)
Avatar of mabell

ASKER

Sorry inthe but the client may stay on the Net after disconnecting from my server
so your solution doesn't work for me.
thanks
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?
ASKER CERTIFIED SOLUTION
Avatar of Epsylon
Epsylon

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.

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

For experts interesting in helping the cleanup effort in their respective TAs, this link please:
https://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=commspt&qid=20274643
 
Thank you,
Moondancer
Moderator @ Experts Exchange