I have two server sockets, some clients is connected to these sockets. When first sockets should be close I need to close second socket also. I'm using this code for it:
procedure TMainForm.FirstSocketDisconnect(AThread: TIdPeerThread);
But problem is: I always gets error message 'Terminate thread timeout' when first socket is trying to close second socket.
As I understand it happens because second socket has some connections.
What should I do? Should I manually disconnected all active connection or what?
Also, this code works in the thread and for closing second socket software needs to get some time, but in the same time first socket is already disconnected becuase first thread is still working.
Need to get solution how can I synchronize two or more sockets or some parts of source code with it.
Please does not provide me Indy examples, I know it very well.