TsgcTCPClient › Methods › Start

Start Method

Connects to the server asynchronously from a secondary thread so the calling thread is not blocked.

Syntax

procedure Start;

Remarks

Start spawns an internal worker thread that sets Active := True, so the caller (typically the main UI thread) returns immediately instead of freezing while the TCP handshake runs. Because the TCP client does not perform a WebSocket upgrade, no HTTP exchange takes place; only the raw socket (and the TLS negotiation, when enabled) is established in the background. The connection is not ready when Start returns; you must wait for the OnConnect event before sending data. The call is ignored when the component is being destroyed. Use Connect if you prefer a blocking call that reports success via its return value.

Example


oClient := TsgcTCPClient.Create(nil);
oClient.Host := '127.0.0.1';
oClient.Port := 5000;
oClient.Start;

Back to Methods