Delphi cross platform: how to check if socket is connected or not


I know this question is asked a lot, I’ve done some search before i post my question here but still can not manage to find a solution for my problem.
In Delphi VCL, i can identify whether a socket is connected or not using;
if Socket.Connected = True then

But in Delphi FMX on Android, there is no such function!
My code:
Procedure TForm24.SocketConnect;
FClientSocket: TSocket;
Buf: TBytes;
//Connect to VCL server
FClientSocket := TSocket.Create(TSocketType.TCP);
FClientSocket.Connect(string.Empty, ‘’+#0, string.Empty, 4851);
//if FClientSocket.Connected then
while True do
// Receive the message from the VCL server
SetLength(Buf, 4);
FClientSocket.Receive(Buf, 4);
// Some code here…

Comments are closed.