TsgcTCPClient › 属性 › LogFile
将入站和出站套接字流量持久化到文件,用于调试线路协议。
property LogFile: TsgcWSLogFile read GetLogFile write SetLogFile;
Enabled=False, Raw=False
将 Enabled=True 并将 FileName 设置为输出日志的完整路径。在原始 TCP 会话上发送或接收的每个块都会附加到文件中。Raw 以十六进制而非纯文本存储字节,这在负载为二进制时非常有用。对日志文件的访问不是线程安全的,不要在多个线程之间共享同一文件。
oTCP := TsgcTCPClient.Create(nil);
oTCP.Host := 'www.esegece.com';
oTCP.Port := 2053;
oTCP.LogFile.FileName := 'C:\Logs\tcp.log';
oTCP.LogFile.Enabled := true;
oTCP.Active := true;