MQL5 ReferenceNetwork FunctionsSocketIsConnected 

SocketIsConnected

Checks if the socket is currently connected.

bool  SocketIsConnected(
   const int  socket      // socket handle
   );

Parameters

socket

[in]  Socket handle returned by the SocketCreate() function. When an incorrect handle is passed to _LastError, the error 5270 (ERR_NETSOCKET_INVALIDHANDLE) is activated.

Return Value

Returns true if the socket is connected, otherwise - false.

Note

The SocketIsConnected() function allows checking the current socket connection status.

The function can be called only from Expert Advisors and scripts, as they run in their own execution threads. If calling from an indicator, GetLastError() returns the error 4014 – "Function is not allowed for call".

See also

SocketConnect, SocketIsWritable, SocketCreate, SocketClose