TsgcWebSocketClient | 连接 TCP 服务器

TsgcWebSocketClient 可以连接到 WebSocket 服务器,但也可以连接到普通 TCP 服务器。

URL 属性

连接到 TCP 服务器最简单的方法是使用 URL 属性并将 Active = true 设置。

 

示例: 连接到 127.0.0.1 端口 5555


oClient := TsgcWebSocketClient.Create(nil);
oClient.URL := 'tcp://127.0.0.1:5555';
oClient.Active := true;

主机、端口和参数

您可以使用 Host 和 port 属性连接到 TCP 服务器。

 

示例: 连接到 127.0.0.1 端口 5555


oClient := TsgcWebSocketClient.Create(nil);
oClient.Specifications.RFC6455 := false;
oClient.Host := '127.0.0.1';
oClient.Port := 5555;
oClient.Active := true;