Create connection
Creates a TCP connection
- Parameters
- Advanced call ?
Function CreateConnection(Val Address, Val Tls = "", Val Proxy = "", Val Logging = Undefined) Export
| Parameter | CLI option | Type | Required | Description |
|---|---|---|---|---|
| Address | - | String | ✔ | Address and port |
| Tls | - | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
| Proxy | - | Structure Of KeyAndValue | ✖ | Proxy settings, if required. See GetProxySettings |
| Logging | - | Structure Of KeyAndValue | ✖ | Logging settings. See GetLoggingSettings |
Returns
Map Of KeyAndValue, Arbitrary - Returns TCP client object on successful connection or error information
| Parameter | Description |
|---|---|
| addin_mode | Manual selection of external component connection mode (for 1C): Isolated, NotIsolated |
Caution
NOCLI: this method is not available in CLI version
1C:Enterprise/OneScript code example
Address = "45.79.112.203:4242";
Connection = OPI_TCP.CreateConnection(Address);
OPI_TCP.CloseConnection(Connection);
Address = "tcpbin.com:4243";
Tls = OPI_TCP.GetTLSSettings(True);
ProxtUser = "proxyuser";
ProxyPassword = "12we...";
ProxyAddress = "127.0.0.1";
ProxyPort = "1080";
Proxy = OPI_TCP.GetProxySettings(ProxyAddress, ProxyPort, "socks5", ProxtUser, ProxyPassword);
Tls = OPI_TCP.GetTLSSettings(True);
Connection = OPI_TCP.CreateConnection(Address, TLS, Proxy);
Result
"AddIn.OPI_TCPClient.Main"