TsgcQUICClient › Methods › Connect
Opens the QUIC connection to the server and blocks until it is established or the timeout expires.
function Connect(const aTimeout: Integer = 10000): Boolean;
| Name | Type | Description |
|---|---|---|
const aTimeout | Integer | Maximum time in milliseconds to wait for the connection to be established. Defaults to 10000 (10 seconds). Pass 0 to start the connection and return immediately without waiting, in which case the result is always False. |
True if the QUIC connection was established before the timeout expired, otherwise False. (Boolean)
Connect sets Active to True, which opens the QUIC connection to Host and Port and performs the TLS 1.3 handshake, then polls until the connection is ready or aTimeout elapses. When it succeeds the OnQUICConnect event fires. Use Start instead when a non-blocking open is preferred.
A False result tells you nothing about why the connection failed, and no exception escapes. Failures are caught and reported through OnQUICException, so handle that event if you need the reason. Two timeouts are in play here and both are applied. aTimeout bounds the whole call, from opening the connection to it being ready to use. SSLQUICOptions.ConnectTimeout bounds the TLS 1.3 handshake inside it, and it is now enforced by the transport, so an unreachable server fails at the configured value, 10000 ms by default, instead of after about thirty seconds as it did before.
if oClient.Connect then
oClient.WriteData(TEncoding.UTF8.GetBytes('Hello QUIC'));