SocketTimeouts

Set timeouts for receiving and sending data for a socket system object.

bool  SocketTimeouts(
   int           socket,               // socket
   uint          timeout_send_ms,      // data sending timeout
   uint          timeout_receive_ms    // data obtaining timeout
   );

Parameters

socket

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

timeout_send_ms

[in]  Data sending timeout in milliseconds.

timeout_receive_ms

[in]  Data obtaining timeout in milliseconds.

Return Value

Returns true if successful, otherwise false.

Note

Do not confuse system object timeouts with the ones set when reading data via SocketRead. SocketTimeout sets timeouts once for a socket object in the operating system. These timeouts are to be applied to all functions for reading and sending data via this socket. In SocketRead, the timeout is set for a certain data reading operation.

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".