mirror of
https://github.com/Bayselonarrend/OpenIntegrations.git
synced 2025-03-29 21:57:16 +02:00
56 lines
1.2 KiB
Plaintext
Vendored
56 lines
1.2 KiB
Plaintext
Vendored
---
|
|
sidebar_position: 3
|
|
---
|
|
|
|
import Tabs from '@theme/Tabs';
|
|
import TabItem from '@theme/TabItem';
|
|
|
|
# Awaiting connection
|
|
Blocks programm execution until a new connection is established
|
|
|
|
|
|
|
|
`Function AwaitingConnection(Val TCPServer, Val Timeout = 0) Export`
|
|
|
|
| Parameter | CLI option | Type | Required | Description |
|
|
|-|-|-|-|-|
|
|
| TCPServer | - | Arbitrary | ✔ | TCP server. See CreateServer |
|
|
| Timeout | - | Number | ✖ | Maximum waiting time for connections. 0 > unlimited |
|
|
|
|
|
|
Returns: Structure Of KeyAndValue - Structure with new connection ID or error information
|
|
|
|
<br/>
|
|
|
|
|
|
:::caution
|
|
**NOCLI:** this method is not available in CLI version
|
|
:::
|
|
<br/>
|
|
|
|
|
|
|
|
```bsl title="1C:Enterprise/OneScript code example"
|
|
TCPServer = OPI_TCP.CreateServer(7788, True);
|
|
|
|
For N = 1 To 5 Do
|
|
|
|
NewConnection = OPI_TCP.AwaitingConnection(TCPServer, 20);
|
|
|
|
If NewConnection["result"] Then
|
|
Connection = NewConnection["connection"];
|
|
Else
|
|
Continue;
|
|
EndIf;
|
|
|
|
Response = OPI_TCP.SendData(TCPServer, Connection, ПолучитьДвоичныеДанныеИзСтроки("Yo"));
|
|
Closing = OPI_TCP.CloseIncomingConnection(TCPServer, Connection);
|
|
|
|
EndDo;
|
|
```
|
|
|
|
|
|
|
|
|
|
|