Solved

Indy: TIdTCPServer.OnDisconnect woes (part II)

Posted on 2004-09-21
4
385 Views
Last Modified: 2011-09-20
It appears that the AThread.Connection.Socket.Binding property is not assigned if a client crashes (AThread: TIdPeerThread is the argument of the TIdTCPServer.OnDisconnect event). How can I get the IP address and the port of the connection that has gone (AThread.Connection.Socket.Binding.PeerIP, AThread.Connection.Socket.Binding.PeerPort)? I need them to free corresponding resources. Actually I loop through an IP-port list and look up the item that's missing in my server instance (<- not very clever?).

Thanks!
0
Comment
Question by:__alex
  • 2
  • 2
4 Comments
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 12114440
I am not sure I understood you, but maybe it is released when the socket crashes... You can rely on some external storage for the connections, because when client crashes, the socket is gone...
0
 
LVL 2

Author Comment

by:__alex
ID: 12130427
Yep, that's what I want to avoid (to keep things simple).
0
 
LVL 12

Accepted Solution

by:
Ivanov_G earned 500 total points
ID: 12131786
try to handle this in TTCPServer.OnException - there you have the thread of the client...
0
 
LVL 2

Author Comment

by:__alex
ID: 12132539
Perfect!
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Simple Delphi Question 9 96
Find and Replace Stream with 0s 8 69
tvirtualstringtree freeze when load too manny images 10 71
Multi-layered image in FireMonkey 9 48
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question