Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 406
  • Last Modified:

Indy: TIdTCPServer.OnDisconnect woes (part II)

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
__alex
Asked:
__alex
  • 2
  • 2
1 Solution
 
Ivanov_GCommented:
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
 
__alexAuthor Commented:
Yep, that's what I want to avoid (to keep things simple).
0
 
Ivanov_GCommented:
try to handle this in TTCPServer.OnException - there you have the thread of the client...
0
 
__alexAuthor Commented:
Perfect!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now