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;
var
FClientSocket: TSocket;
Buf: TBytes;
begin
//Connect to VCL server
FClientSocket := TSocket.Create(TSocketType.TCP);
FClientSocket.Connect(string.Empty, ‘192.168.1.155’+#0, string.Empty, 4851);
//if FClientSocket.Connected then
while True do
begin
// Receive the message from the VCL server
SetLength(Buf, 4);
FClientSocket.Receive(Buf, 4);
// Some code here…
end;
end;

Comments are closed.