When I try to send text from my server to the client but not in an onconnect or onrecieve event, but from a button click even when they are connected, it gives this message and fails to send it.

But when it is in an onconnect or onrecieve event it sends the message and with no trouble.

Could someone please help me?

Socket not connected or address not supplied.

procedure THXDSK.Button1Click(Sender: TObject);
begin
HDSSOCK1.Socket.SendText('Test 2');
end;

Thank you.