I am using Embarcadero C++Builder 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 the Button1::OnClick
event, it connects successfully.
If I assign ClientSocket->Active=true
to the 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 the OnContextCreate
or OnExecute
events.
Why is this happening?