03-20-2023, 06:08 PM 
		
	
	
		Hello. I am using Embarcadero C++ and I have Indy 10.6.2.0 installed.
I have 4 components on my form:
TIdTCPClient *Client;
TIdTCPServer *Server;
TClientSocket *ClientSocket;
TServerSocket *ServerSocket;
Client is configured to connect to Server;
ClientSocket is configured to connect to ServerSocket;
If I assign ClientConnect() to Button1::OnClick event, it connects successfully.
If I assign ClientSocket->Active=true to Button2::OnClick event, it also connects successfully.
However, if I try to connect by setting ClientSocket->Active=true in Server::OnConnect event:
{
ClientSocket->Active=true;
}
It doesn't work. The same is true if I try to connect in OnContextCreate or OnExecute events.
Why is this happening?
	
	
	
	
I have 4 components on my form:
TIdTCPClient *Client;
TIdTCPServer *Server;
TClientSocket *ClientSocket;
TServerSocket *ServerSocket;
Client is configured to connect to Server;
ClientSocket is configured to connect to ServerSocket;
If I assign ClientConnect() to Button1::OnClick event, it connects successfully.
If I assign ClientSocket->Active=true to Button2::OnClick event, it also connects successfully.
However, if I try to connect by setting ClientSocket->Active=true in Server::OnConnect event:
{
ClientSocket->Active=true;
}
It doesn't work. The same is true if I try to connect in OnContextCreate or OnExecute events.
Why is this happening?

 
 

 
